forked from ChomeNS/chomens-bot-java
support daycore
i hate daycore but most people like them for some reason nightcore is just classic and nostalgic
This commit is contained in:
parent
19f9e9af68
commit
cb4af91279
3 changed files with 20 additions and 6 deletions
|
@ -83,7 +83,7 @@ public class BotBossBar extends BossBar {
|
|||
|
||||
if (bot.bossbar.actionBar) return;
|
||||
|
||||
bot.core.run("minecraft:bossbar set " + id + " color " + (color == BossBarColor.LIME ? "green" : color.name().toLowerCase()));
|
||||
bot.core.run("minecraft:bossbar set " + id + " color " + (color == BossBarColor.LIME ? "green" : (color == BossBarColor.CYAN ? "blue" : color.name().toLowerCase())));
|
||||
}
|
||||
|
||||
public String players() {
|
||||
|
|
|
@ -42,7 +42,7 @@ public class BossbarManagerPlugin extends Bot.Listener {
|
|||
}
|
||||
});
|
||||
|
||||
bot.executor.scheduleAtFixedRate(this::check, 0, 500, TimeUnit.MILLISECONDS);
|
||||
bot.executor.scheduleAtFixedRate(this::check, 0, 600, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -211,7 +211,7 @@ public class BossbarManagerPlugin extends Bot.Listener {
|
|||
|
||||
bot.core.run("minecraft:bossbar add " + name + " " + stringifiedName);
|
||||
bot.core.run(prefix + "players " + bossBar.players());
|
||||
bot.core.run(prefix + "color " + (bossBar.color == BossBarColor.LIME ? "green" : bossBar.color.name().toLowerCase()));
|
||||
bot.core.run(prefix + "color " + (bossBar.color == BossBarColor.LIME ? "green" : (bossBar.color == BossBarColor.CYAN ? "blue" : bossBar.color.name().toLowerCase())));
|
||||
bot.core.run(prefix + "visible " + bossBar.visible());
|
||||
bot.core.run(prefix + "style " + division);
|
||||
bot.core.run(prefix + "max " + bossBar.max());
|
||||
|
|
|
@ -59,6 +59,8 @@ public class MusicPlayerPlugin extends Bot.Listener {
|
|||
|
||||
private final String bossbarName = "music";
|
||||
|
||||
public BossBarColor bossBarColor;
|
||||
|
||||
public MusicPlayerPlugin (Bot bot) {
|
||||
this.bot = bot;
|
||||
bot.addListener(this);
|
||||
|
@ -139,7 +141,7 @@ public class MusicPlayerPlugin extends Bot.Listener {
|
|||
|
||||
if (bot.bossbar.enabled && bot.options.useCore) {
|
||||
bossBar.setTitle(generateBossbar());
|
||||
bossBar.setColor(pitch > 0 ? BossBarColor.PURPLE : BossBarColor.YELLOW);
|
||||
bossBar.setColor(bossBarColor);
|
||||
bossBar.setValue((int) Math.floor(((double) currentSong.time / 1000) * speed));
|
||||
bossBar.setMax((long) ((currentSong.length / 1000) * speed));
|
||||
}
|
||||
|
@ -211,7 +213,7 @@ public class MusicPlayerPlugin extends Bot.Listener {
|
|||
final BotBossBar bossBar = new BotBossBar(
|
||||
Component.empty(),
|
||||
BOTH_SELECTOR,
|
||||
BossBarColor.WHITE,
|
||||
BossBarColor.LIME,
|
||||
BossBarDivision.NONE,
|
||||
true,
|
||||
(int) currentSong.length / 1000,
|
||||
|
@ -229,8 +231,20 @@ public class MusicPlayerPlugin extends Bot.Listener {
|
|||
}
|
||||
|
||||
public Component generateBossbar () {
|
||||
NamedTextColor namedTextColor;
|
||||
if (pitch > 0) {
|
||||
namedTextColor = NamedTextColor.LIGHT_PURPLE;
|
||||
bossBarColor = BossBarColor.PURPLE;
|
||||
} else if (pitch < 0) {
|
||||
namedTextColor = NamedTextColor.AQUA;
|
||||
bossBarColor = BossBarColor.CYAN;
|
||||
} else {
|
||||
namedTextColor = NamedTextColor.GREEN;
|
||||
bossBarColor = BossBarColor.YELLOW;
|
||||
}
|
||||
|
||||
Component component = Component.empty()
|
||||
.append(Component.empty().append(Component.text(currentSong.name)).color(pitch > 0 ? NamedTextColor.LIGHT_PURPLE : NamedTextColor.GREEN))
|
||||
.append(Component.empty().append(Component.text(currentSong.name)).color(namedTextColor))
|
||||
.append(Component.text(" | ").color(NamedTextColor.DARK_GRAY))
|
||||
.append(
|
||||
Component
|
||||
|
|
Loading…
Reference in a new issue