From a15096ae1c4e9037926662b0cff9aee613ad2b73 Mon Sep 17 00:00:00 2001 From: mbax Date: Tue, 2 Jul 2013 14:18:02 -0400 Subject: Send event-defined MOTD/maxplayers. Fixes BUKKIT-4409 Also, revert to previous CraftBukkit functionality --- .../java/net/minecraft/server/PendingConnection.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/main/java/net/minecraft') diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java index 252cea7c..043321dc 100644 --- a/src/main/java/net/minecraft/server/PendingConnection.java +++ b/src/main/java/net/minecraft/server/PendingConnection.java @@ -150,18 +150,21 @@ public class PendingConnection extends Connection { // CraftBukkit s = pingEvent.getMotd() + "\u00A7" + playerlist.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers(); } else { - List list = Arrays.asList(new Serializable[] { Integer.valueOf(1), Integer.valueOf(73), this.server.getVersion(), this.server.getMotd(), Integer.valueOf(playerlist.getPlayerCount()), Integer.valueOf(playerlist.getMaxPlayers())}); + // CraftBukkit start - Don't create a list from an array + Object[] list = new Object[] { 1, 73, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() }; - Object object; - - for (Iterator iterator = list.iterator(); iterator.hasNext(); s = s + object.toString().replaceAll("\0", "")) { - object = iterator.next(); - if (s == null) { - s = "\u00A7"; + StringBuilder builder = new StringBuilder(); + for (Object object : list) { + if (builder.length() == 0) { + builder.append('\u00A7'); } else { - s = s + '\0'; + builder.append('\0'); } + + builder.append(org.apache.commons.lang.StringUtils.replace(object.toString(), "\0", "")); } + s = builder.toString(); + // CraftBukkit end } InetAddress inetaddress = null; -- cgit v1.2.3