Skip to content

Commit

Permalink
Fix java 8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
bivashy committed Sep 5, 2022
1 parent 01b1b31 commit 034f09e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void executeUrlSubcommand(Player player, URL musicUrl, @Default("-1") @Fl
InputStream urlStream = new BufferedInputStream(createProgressStream(connection.getInputStream(), connection.getContentLength(), player));
Optional<ISoundFormat> optionalSoundFormat = getSoundFormat(musicUrl, urlStream);

if (optionalSoundFormat.isEmpty()) {
if (!optionalSoundFormat.isPresent()) {
player.sendMessage(config.getMessages().getMessage("cannot-create-sound"));
urlStream.close();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public InputStream createCachedInputStream(URL url, InputStream connectionStream
plugin.getCachedSoundHolder().findFirstByPredicate(sound -> sound.getUrl().equals(url.toString()));
Optional<Path> cachedSoundPath = cachedSound.map(sound -> Paths.get(sound.getCachedFile()));

if (cachedSound.isEmpty() || forceCache) {
if (!cachedSound.isPresent() || forceCache) {
Path musicPath = cachedSoundPath.orElse(File.createTempFile("music", "", cacheDirectory).toPath());
Files.copy(connectionStream, musicPath, StandardCopyOption.REPLACE_EXISTING);
connectionStream.close();
Expand Down

0 comments on commit 034f09e

Please sign in to comment.