From 8f217e989a29b7cca0f84c5cda2835bebc136076 Mon Sep 17 00:00:00 2001 From: Timon Date: Tue, 14 Nov 2023 15:06:55 +0100 Subject: [PATCH] Optimized sending of me and say command --- src/main/java/timongcraft/system/commands/MeCommand.java | 5 ++--- src/main/java/timongcraft/system/commands/SayCommand.java | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/timongcraft/system/commands/MeCommand.java b/src/main/java/timongcraft/system/commands/MeCommand.java index fd4581a..d161bb1 100644 --- a/src/main/java/timongcraft/system/commands/MeCommand.java +++ b/src/main/java/timongcraft/system/commands/MeCommand.java @@ -5,6 +5,7 @@ import dev.jorel.commandapi.CommandTree; import dev.jorel.commandapi.arguments.GreedyStringArgument; import dev.jorel.commandapi.executors.CommandArguments; +import net.md_5.bungee.api.chat.TranslatableComponent; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -23,9 +24,7 @@ public static void register() { } private static void meManager(CommandSender sender, CommandArguments args) { - String msg = (String) args.get("message"); - - Bukkit.broadcastMessage("* " + sender.getName() + " " + msg); + Bukkit.spigot().broadcast(new TranslatableComponent("chat.type.emote", sender.getName(), args.get("message"))); } } diff --git a/src/main/java/timongcraft/system/commands/SayCommand.java b/src/main/java/timongcraft/system/commands/SayCommand.java index 3636cdf..dbcb061 100644 --- a/src/main/java/timongcraft/system/commands/SayCommand.java +++ b/src/main/java/timongcraft/system/commands/SayCommand.java @@ -24,9 +24,7 @@ public static void register() { } private static void sayManager(CommandSender sender, CommandArguments args) { - TranslatableComponent message = new TranslatableComponent("chat.type.announcement", sender.getName(), args.get("message")); - - Bukkit.spigot().broadcast(message); + Bukkit.spigot().broadcast(new TranslatableComponent("chat.type.announcement", sender.getName(), args.get("message"))); } } \ No newline at end of file