diff options
author | mbax <matt@phozop.net> | 2013-07-02 14:18:02 -0400 |
---|---|---|
committer | mbax <matt@phozop.net> | 2013-07-02 16:36:57 -0400 |
commit | a15096ae1c4e9037926662b0cff9aee613ad2b73 (patch) | |
tree | ba87d4f0247f1e08dd568d5777ed4f13522c0cfb /src/main/java/net/minecraft | |
parent | 905f00b0704b86f3d20992061fb312534687b26b (diff) | |
download | craftbukkit-a15096ae1c4e9037926662b0cff9aee613ad2b73.tar craftbukkit-a15096ae1c4e9037926662b0cff9aee613ad2b73.tar.gz craftbukkit-a15096ae1c4e9037926662b0cff9aee613ad2b73.tar.lz craftbukkit-a15096ae1c4e9037926662b0cff9aee613ad2b73.tar.xz craftbukkit-a15096ae1c4e9037926662b0cff9aee613ad2b73.zip |
Send event-defined MOTD/maxplayers. Fixes BUKKIT-4409
Also, revert to previous CraftBukkit functionality
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r-- | src/main/java/net/minecraft/server/PendingConnection.java | 19 |
1 files changed, 11 insertions, 8 deletions
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; |