diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index 8001582e..fd71b8cd 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -23,8 +23,6 @@ import java.io.IOException; import java.io.PrintStream; import java.net.InetSocketAddress; import java.text.MessageFormat; -import java.text.SimpleDateFormat; -import java.util.Calendar; import java.util.Collection; import java.util.Collections; import java.util.HashSet; @@ -44,7 +42,6 @@ import jline.internal.Log; import lombok.Getter; import lombok.Setter; import lombok.Synchronized; -import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ReconnectHandler; @@ -492,8 +489,7 @@ public class BungeeCord extends ProxyServer { getConsole().sendMessage( message ); // TODO: Here too - String encoded = BungeeCord.getInstance().gson.toJson( message ); - broadcast( new Chat( "{\"text\":" + encoded + "}" ) ); + broadcast( new Chat( Util.stupify( message ) ) ); } public void addConnection(UserConnection con) diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 1afb3995..6e26354a 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -255,7 +255,7 @@ public final class UserConnection implements ProxiedPlayer if ( ch.getHandle().isActive() ) { bungee.getLogger().log( Level.INFO, "[" + getName() + "] disconnected with: " + reason ); - unsafe().sendPacket( new Kick( BungeeCord.getInstance().gson.toJson( reason ) ) ); + unsafe().sendPacket( new Kick( Util.stupify( reason ) ) ); ch.close(); if ( server != null ) { @@ -275,8 +275,7 @@ public final class UserConnection implements ProxiedPlayer public void sendMessage(String message) { // TODO: Fix this - String encoded = BungeeCord.getInstance().gson.toJson( message ); - unsafe().sendPacket( new Chat( "{\"text\":" + encoded + "}" ) ); + unsafe().sendPacket( new Chat( Util.stupify( message ) ) ); } @Override diff --git a/proxy/src/main/java/net/md_5/bungee/Util.java b/proxy/src/main/java/net/md_5/bungee/Util.java index b42808f8..cd8b6df2 100644 --- a/proxy/src/main/java/net/md_5/bungee/Util.java +++ b/proxy/src/main/java/net/md_5/bungee/Util.java @@ -70,4 +70,10 @@ public class Util return ( ret.length() == 0 ) ? "" : ret.substring( 0, ret.length() - separators.length() ); } + + public static String stupify(String text) + { + // TODO: Colour text wrapper to work around 1.7 client bug with section sign + return "{\"text\":" + BungeeCord.getInstance().gson.toJson( text ) + "}"; + } } diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index a8aff99d..8190d6c8 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -396,7 +396,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection { if ( !ch.isClosed() ) { - unsafe().sendPacket( new Kick( BungeeCord.getInstance().gson.toJson( reason ) ) ); + unsafe().sendPacket( new Kick( Util.stupify( reason ) ) ); ch.close(); } }