diff --git a/build.gradle.kts b/build.gradle.kts index a643a48..f11efef 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,7 @@ dependencies { compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT") implementation("net.thenextlvl.core:api:4.0.1") - implementation("net.thenextlvl.core:i18n:1.0.4") + implementation("net.thenextlvl.core:i18n:1.0.6") implementation("org.bstats:bstats-bukkit:3.0.2") annotationProcessor("org.projectlombok:lombok:1.18.26") diff --git a/src/main/java/net/thenextlvl/tweaks/command/server/BroadcastCommand.java b/src/main/java/net/thenextlvl/tweaks/command/server/BroadcastCommand.java index 973dd5b..663eca6 100644 --- a/src/main/java/net/thenextlvl/tweaks/command/server/BroadcastCommand.java +++ b/src/main/java/net/thenextlvl/tweaks/command/server/BroadcastCommand.java @@ -6,10 +6,12 @@ import net.thenextlvl.tweaks.command.api.CommandInfo; import org.bukkit.Bukkit; import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; +import org.bukkit.command.TabExecutor; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; @CommandInfo( name = "broadcast", @@ -19,7 +21,7 @@ aliases = {"bc"} ) @RequiredArgsConstructor -public class BroadcastCommand implements CommandExecutor { +public class BroadcastCommand implements TabExecutor { private final TweaksPlugin plugin; @Override @@ -30,14 +32,14 @@ public boolean onCommand(CommandSender sender, Command command, String label, St var tweaksConfig = plugin.config(); var message = String.join(" ", args).replace("\\t", " "); - var format = format(plugin.bundle().format(sender, "broadcast.format"), message); var receivers = new ArrayList(Bukkit.getOnlinePlayers()); receivers.add(Bukkit.getConsoleSender()); receivers.forEach(audience -> { plugin.bundle().sendMessage(audience, "broadcast.header"); - plugin.bundle().sendMessage(audience, format); + var format = format(plugin.bundle().format(audience, "broadcast.format"), message); + plugin.bundle().sendRawMessage(audience, format); plugin.bundle().sendMessage(audience, "broadcast.footer"); }); @@ -53,4 +55,9 @@ private String format(String format, String message) { return String.join("\n", split); } + + @Override + public List onTabComplete(CommandSender sender, Command command, String label, String[] args) { + return Arrays.asList(args[args.length - 1] + "\\n", args[args.length - 1] + "\\t"); + } }