From cc08c76020ef29578c70f3f4452e12ae5f430cb7 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 27 Aug 2023 07:34:45 +0700 Subject: [PATCH] fix error `currentSong.name is null` or whatever shit that was --- .../plugins/MusicPlayerPlugin.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MusicPlayerPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MusicPlayerPlugin.java index c226fe9..6a2f370 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MusicPlayerPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MusicPlayerPlugin.java @@ -126,22 +126,22 @@ public class MusicPlayerPlugin extends Bot.Listener { if (currentSong.paused && ticksUntilPausedBossbar-- < 0) return; else ticksUntilPausedBossbar = 20 - (((int) bot.tps.getTickRate()) - 20); - BotBossBar bossBar = bot.bossbar.get(bossbarName); + if (!currentSong.finished()) { + BotBossBar bossBar = bot.bossbar.get(bossbarName); - if (bossBar == null && bot.bossbar.enabled) bossBar = addBossBar(); + if (bossBar == null && bot.bossbar.enabled) bossBar = addBossBar(); - if (bot.bossbar.enabled && bot.options.useCore) { - bossBar.setTitle(generateBossbar()); - bossBar.setColor(pitch > 0 ? BossBarColor.PURPLE : BossBarColor.YELLOW); - bossBar.setValue((int) Math.floor(((double) currentSong.time / 1000) * speed)); - bossBar.setMax((long) ((currentSong.length / 1000) * speed)); - } + if (bot.bossbar.enabled && bot.options.useCore) { + bossBar.setTitle(generateBossbar()); + bossBar.setColor(pitch > 0 ? BossBarColor.PURPLE : BossBarColor.YELLOW); + bossBar.setValue((int) Math.floor(((double) currentSong.time / 1000) * speed)); + bossBar.setMax((long) ((currentSong.length / 1000) * speed)); + } - if (currentSong.paused || bot.core.isRateLimited()) return; + if (currentSong.paused || bot.core.isRateLimited()) return; - handlePlaying(); - - if (currentSong.finished()) { + handlePlaying(); + } else { if (loop == Loop.CURRENT) { currentSong.loop(); return;