This commit is contained in:
Chayapak 2023-05-15 20:57:56 +07:00
parent a2dc3e39e7
commit 3fc9ee5d2e
5 changed files with 19 additions and 31 deletions

View file

@ -8,10 +8,10 @@ import net.kyori.adventure.text.Component;
@AllArgsConstructor
public class BossBar {
@Getter @Setter private Component name;
@Getter @Setter private BossBarColor color;
@Getter @Setter private String color;
@Getter @Setter private long max;
@Getter @Setter private String players;
@Getter @Setter private BossBarStyle style;
@Getter @Setter private String style;
@Getter @Setter private int value;
@Getter @Setter private boolean visible;
}

View file

@ -1,17 +1,11 @@
package land.chipmunk.chayapak.chomens_bot.data;
public enum BossBarColor {
BLUE("blue"),
GREEN("green"),
PINK("pink"),
PURPLE("purple"),
RED("red"),
WHITE("white"),
YELLOW("yellow"),;
public final String color;
BossBarColor (String color) {
this.color = color;
}
public class BossBarColor {
public static final String BLUE = "blue";
public static final String GREEN = "green";
public static final String PINK = "pink";
public static final String PURPLE = "purple";
public static final String RED = "red";
public static final String WHITE = "white";
public static final String YELLOW = "yellow";
}

View file

@ -1,15 +1,9 @@
package land.chipmunk.chayapak.chomens_bot.data;
public enum BossBarStyle {
NOTCHED_10("notched_10"),
NOTCHED_12("notched_12"),
NOTCHED_20("notched_20"),
NOTCHED_6("notched_6"),
PROGRESS("progress");
public final String style;
BossBarStyle (String style) {
this.style = style;
}
public class BossBarStyle {
public static final String NOTCHED_10 = "notched_10";
public static final String NOTCHED_12 = "notched_12";
public static final String NOTCHED_20 = "notched_20";
public static final String NOTCHED_6 = "notched_6";
public static final String PROGRESS = "progress";
}

View file

@ -44,9 +44,9 @@ public class BossbarManagerPlugin extends Bot.Listener {
if (!actionBar) {
bot.core().run("minecraft:bossbar add " + bossBarPrefix + name + " \"\"");
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " players " + bossBar.players());
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " color " + bossBar.color().color);
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " color " + bossBar.color());
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " visible " + bossBar.visible());
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " style " + bossBar.style().style);
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " style " + bossBar.style());
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " max " + bossBar.max());
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " name " + stringifiedComponent);
bot.core().run("minecraft:bossbar set " + bossBarPrefix + name + " value " + bossBar.value());

View file

@ -100,7 +100,7 @@ public class TPSPlugin extends Bot.Listener {
else return NamedTextColor.DARK_RED;
}
private BossBarColor getBossBarColor (double tickRate) {
private String getBossBarColor (double tickRate) {
if (tickRate > 15) return BossBarColor.GREEN;
else if (tickRate == 15) return BossBarColor.YELLOW;
else if (tickRate < 15 && tickRate > 10) return BossBarColor.RED;