fix error currentSong.name is null or whatever shit that was

This commit is contained in:
Chayapak 2023-08-27 07:34:45 +07:00
parent f75f76b9d4
commit cc08c76020

View file

@ -126,22 +126,22 @@ public class MusicPlayerPlugin extends Bot.Listener {
if (currentSong.paused && ticksUntilPausedBossbar-- < 0) return; if (currentSong.paused && ticksUntilPausedBossbar-- < 0) return;
else ticksUntilPausedBossbar = 20 - (((int) bot.tps.getTickRate()) - 20); 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) { if (bot.bossbar.enabled && bot.options.useCore) {
bossBar.setTitle(generateBossbar()); bossBar.setTitle(generateBossbar());
bossBar.setColor(pitch > 0 ? BossBarColor.PURPLE : BossBarColor.YELLOW); bossBar.setColor(pitch > 0 ? BossBarColor.PURPLE : BossBarColor.YELLOW);
bossBar.setValue((int) Math.floor(((double) currentSong.time / 1000) * speed)); bossBar.setValue((int) Math.floor(((double) currentSong.time / 1000) * speed));
bossBar.setMax((long) ((currentSong.length / 1000) * speed)); bossBar.setMax((long) ((currentSong.length / 1000) * speed));
} }
if (currentSong.paused || bot.core.isRateLimited()) return; if (currentSong.paused || bot.core.isRateLimited()) return;
handlePlaying(); handlePlaying();
} else {
if (currentSong.finished()) {
if (loop == Loop.CURRENT) { if (loop == Loop.CURRENT) {
currentSong.loop(); currentSong.loop();
return; return;