diff --git a/src/main/java/net/dreamerzero/titleannouncer/paper/utils/PaperBossBar.java b/src/main/java/net/dreamerzero/titleannouncer/paper/utils/PaperBossBar.java index 7e8425c..bea4554 100644 --- a/src/main/java/net/dreamerzero/titleannouncer/paper/utils/PaperBossBar.java +++ b/src/main/java/net/dreamerzero/titleannouncer/paper/utils/PaperBossBar.java @@ -9,11 +9,12 @@ public class PaperBossBar { private Announcer plugin; + private float value; public PaperBossBar(Announcer plugin){ this.plugin = plugin; + this.value = 1f; } - private float value = 1f; /** * It will send a bossbar to the specified audience, * with the specified characteristics showing an @@ -32,7 +33,7 @@ public void sendBukkitBossBar ( final BossBar.Color color, final BossBar.Overlay type) { - float finalTime = 0.1f/time; + final float finalTime = 0.1f/time; BossBar bar = BossBar.bossBar( content, @@ -40,13 +41,11 @@ public void sendBukkitBossBar ( color, type); - value =1f; audience.showBossBar(bar); - final float toReduce = finalTime; new BukkitRunnable() { @Override public void run() { - value -= toReduce; + value -= finalTime; if (value <= 0.02) { audience.hideBossBar(bar); cancel(); diff --git a/src/main/java/net/dreamerzero/titleannouncer/paper/utils/RegisterCommands.java b/src/main/java/net/dreamerzero/titleannouncer/paper/utils/RegisterCommands.java index 546f013..7522e5d 100644 --- a/src/main/java/net/dreamerzero/titleannouncer/paper/utils/RegisterCommands.java +++ b/src/main/java/net/dreamerzero/titleannouncer/paper/utils/RegisterCommands.java @@ -20,7 +20,6 @@ import net.dreamerzero.titleannouncer.paper.commands.title.SelfTitleCommand; import net.dreamerzero.titleannouncer.paper.commands.title.SendTitleCommand; import net.dreamerzero.titleannouncer.paper.commands.title.WorldTitleCommand; -import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; public class RegisterCommands { private Announcer plugin; @@ -65,11 +64,10 @@ private void initCommand(CommandFactory ...factories) { PluginCommand command = this.plugin.getCommand(factory.getCommand()); command.setExecutor(factory.getExecutor()); // Waiting for https://github.com/PaperMC/Paper/pull/6676 - command.setPermissionMessage( - LegacyComponentSerializer.legacySection().serialize( - new ConfigUtils().getPrefix().append( + command.permissionMessage( + new ConfigUtils().getPrefix().append( new MiniMessageUtil().parse( - config.getString("messages.general.no-permission"))))); + config.getString("messages.general.no-permission")))); } } } diff --git a/src/main/java/net/dreamerzero/titleannouncer/velocity/commands/AnnouncerCommand.java b/src/main/java/net/dreamerzero/titleannouncer/velocity/commands/AnnouncerCommand.java index 6806d42..31b3a39 100644 --- a/src/main/java/net/dreamerzero/titleannouncer/velocity/commands/AnnouncerCommand.java +++ b/src/main/java/net/dreamerzero/titleannouncer/velocity/commands/AnnouncerCommand.java @@ -18,16 +18,15 @@ public void execute(Invocation invocation) { String[] args = invocation.arguments(); ConfigUtils config = new ConfigUtils(); MiniMessageUtil mUtils = new MiniMessageUtil(); - VelocityHelpMessages vMessages = new VelocityHelpMessages(); if (args.length == 0) { source.sendMessage(mUtils.parse( "TitleAnnouncer by 4drian3d")); config.helpPrefix(source); - source.sendMessage(vMessages.titleHelpMessage); - source.sendMessage(vMessages.actionbarHelpMessage); - source.sendMessage(vMessages.bossbarHelpMessage); - source.sendMessage(vMessages.fullwikilink); + source.sendMessage(VelocityHelpMessages.titleHelpMessage); + source.sendMessage(VelocityHelpMessages.actionbarHelpMessage); + source.sendMessage(VelocityHelpMessages.bossbarHelpMessage); + source.sendMessage(VelocityHelpMessages.fullwikilink); return; } @@ -44,29 +43,29 @@ public void execute(Invocation invocation) { if(args.length == 2){ switch (args[1].toLowerCase()) { case "title" -> { - source.sendMessage(vMessages.titleHelpMessage); - source.sendMessage(vMessages.titlewikilink); + source.sendMessage(VelocityHelpMessages.titleHelpMessage); + source.sendMessage(VelocityHelpMessages.titlewikilink); } case "actionbar" -> { - source.sendMessage(vMessages.actionbarHelpMessage); - source.sendMessage(vMessages.actionbarwikilink); + source.sendMessage(VelocityHelpMessages.actionbarHelpMessage); + source.sendMessage(VelocityHelpMessages.actionbarwikilink); } case "bossbar" -> { - source.sendMessage(vMessages.bossbarHelpMessage); - source.sendMessage(vMessages.bossbarwikilink); + source.sendMessage(VelocityHelpMessages.bossbarHelpMessage); + source.sendMessage(VelocityHelpMessages.bossbarwikilink); } default -> { - source.sendMessage(vMessages.titleHelpMessage); - source.sendMessage(vMessages.actionbarHelpMessage); - source.sendMessage(vMessages.bossbarHelpMessage); - source.sendMessage(vMessages.fullwikilink); + source.sendMessage(VelocityHelpMessages.titleHelpMessage); + source.sendMessage(VelocityHelpMessages.actionbarHelpMessage); + source.sendMessage(VelocityHelpMessages.bossbarHelpMessage); + source.sendMessage(VelocityHelpMessages.fullwikilink); } } } else { - source.sendMessage(vMessages.titleHelpMessage); - source.sendMessage(vMessages.actionbarHelpMessage); - source.sendMessage(vMessages.bossbarHelpMessage); - source.sendMessage(vMessages.fullwikilink); + source.sendMessage(VelocityHelpMessages.titleHelpMessage); + source.sendMessage(VelocityHelpMessages.actionbarHelpMessage); + source.sendMessage(VelocityHelpMessages.bossbarHelpMessage); + source.sendMessage(VelocityHelpMessages.fullwikilink); } } default -> { diff --git a/src/main/java/net/dreamerzero/titleannouncer/velocity/utils/VPlaceholders.java b/src/main/java/net/dreamerzero/titleannouncer/velocity/utils/VPlaceholders.java index 8e04968..487ccd4 100644 --- a/src/main/java/net/dreamerzero/titleannouncer/velocity/utils/VPlaceholders.java +++ b/src/main/java/net/dreamerzero/titleannouncer/velocity/utils/VPlaceholders.java @@ -14,12 +14,15 @@ public VPlaceholders(ProxyServer proxy){ this.proxy = proxy; } public List