Don't broadcast to console

This commit is contained in:
mathias 2019-03-10 13:04:48 +02:00
parent 457fdefce2
commit 8eadbd89b1
2 changed files with 9 additions and 5 deletions

View file

@ -35,10 +35,12 @@ import org.bukkit.scheduler.BukkitRunnable;
class CommandClearChat implements CommandExecutor { class CommandClearChat implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
for (int i = 0; i < 100; ++i) { for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
Bukkit.broadcastMessage(""); for (int i = 0; i < 100; ++i) {
onlinePlayer.sendMessage("");
}
onlinePlayer.sendMessage(ChatColor.DARK_GREEN + "The chat has been cleared");
} }
Bukkit.broadcastMessage(ChatColor.DARK_GREEN + "The chat has been cleared");
return true; return true;
} }
} }
@ -265,7 +267,9 @@ class CommandTellraw implements CommandExecutor {
if (args.length == 0) { if (args.length == 0) {
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <message ..>"); player.sendMessage(ChatColor.RED + "Usage: /" + label + " <message ..>");
} else { } else {
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', String.join(" ", args))); for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
onlinePlayer.sendMessage(ChatColor.translateAlternateColorCodes('&', String.join(" ", args)));
}
} }
return true; return true;
} }

View file

@ -572,7 +572,7 @@ class Events implements Listener {
@EventHandler @EventHandler
void onPlayerLogin(PlayerLoginEvent event) { void onPlayerLogin(PlayerLoginEvent event) {
if ((event.getHostname().startsWith("play.kaboom.pw") && if (!(event.getHostname().startsWith("play.kaboom.pw") &&
event.getHostname().endsWith(":64518"))) { event.getHostname().endsWith(":64518"))) {
event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw"); event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw");
} else { } else {