diff --git a/paper-api/src/main/java/org/bukkit/command/defaults/SayCommand.java b/paper-api/src/main/java/org/bukkit/command/defaults/SayCommand.java index 427897ff25..c48c5c3017 100644 --- a/paper-api/src/main/java/org/bukkit/command/defaults/SayCommand.java +++ b/paper-api/src/main/java/org/bukkit/command/defaults/SayCommand.java @@ -6,6 +6,7 @@ import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; import com.google.common.collect.ImmutableList; @@ -14,7 +15,7 @@ public class SayCommand extends VanillaCommand { public SayCommand() { super("say"); this.description = "Broadcasts the given message as the console"; - this.usageMessage = "/say "; + this.usageMessage = "/say "; this.setPermission("bukkit.command.say"); } @@ -27,20 +28,24 @@ public class SayCommand extends VanillaCommand { } StringBuilder message = new StringBuilder(); + message.append(ChatColor.LIGHT_PURPLE).append("["); + if (sender instanceof ConsoleCommandSender) { + message.append("Server"); + } else if (sender instanceof Player) { + message.append(((Player) sender).getDisplayName()); + } else { + message.append(sender.getName()); + } + message.append(ChatColor.LIGHT_PURPLE).append("] "); + if (args.length > 0) { message.append(args[0]); for (int i = 1; i < args.length; i++) { - message.append(" "); - message.append(args[i]); + message.append(" ").append(args[i]); } } - if (sender instanceof Player) { - Bukkit.getLogger().info("[" + sender.getName() + "] " + message); - } - - Bukkit.broadcastMessage(ChatColor.LIGHT_PURPLE + "[Server] " + message); - + Bukkit.broadcastMessage(message.toString()); return true; }