From be3149dc7a8bd92527dd2ae00d61a893a82ce33a Mon Sep 17 00:00:00 2001 From: Allink Date: Sat, 21 May 2022 21:14:14 +0100 Subject: [PATCH] Make clearchat sendMessage to individual players instead of broadcasting --- .../pw/kaboom/extras/commands/CommandClearChat.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/pw/kaboom/extras/commands/CommandClearChat.java b/src/main/java/pw/kaboom/extras/commands/CommandClearChat.java index 6f128bf..6eeebd9 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandClearChat.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandClearChat.java @@ -6,6 +6,7 @@ import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; import javax.annotation.Nonnull; @@ -22,10 +23,12 @@ public final class CommandClearChat implements CommandExecutor { .append(Component.newline()); } - Bukkit.getServer().broadcast(clearChatComponent - .append(Component - .text("The chat has been cleared", - NamedTextColor.DARK_GREEN))); + for (Player onlinePlayer : Bukkit.getOnlinePlayers()) { + onlinePlayer.sendMessage(clearChatComponent + .append(Component + .text("The chat has been cleared", + NamedTextColor.DARK_GREEN))); + } return true; }