knohacks - thanks @ammaraskar

This commit is contained in:
md_5 2013-07-01 13:37:03 +10:00
parent 1296783d9b
commit 788b96dc0a
4 changed files with 12 additions and 3 deletions

View File

@ -19,6 +19,12 @@
<description>Proxy component of the Elastic Portal Suite</description> <description>Proxy component of the Elastic Portal Suite</description>
<dependencies> <dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId> <artifactId>netty-codec</artifactId>

View File

@ -5,6 +5,7 @@ import net.md_5.bungee.log.BungeeLogger;
import net.md_5.bungee.reconnect.SQLReconnectHandler; import net.md_5.bungee.reconnect.SQLReconnectHandler;
import net.md_5.bungee.scheduler.BungeeScheduler; import net.md_5.bungee.scheduler.BungeeScheduler;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.gson.Gson;
import com.ning.http.client.AsyncHttpClient; import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.AsyncHttpClientConfig; import com.ning.http.client.AsyncHttpClientConfig;
import com.ning.http.client.providers.netty.NettyAsyncHttpProvider; import com.ning.http.client.providers.netty.NettyAsyncHttpProvider;
@ -130,6 +131,7 @@ public class BungeeCord extends ProxyServer
private ConsoleReader consoleReader; private ConsoleReader consoleReader;
@Getter @Getter
private final Logger logger; private final Logger logger;
public final Gson gson = new Gson();
{ {
@ -488,7 +490,8 @@ public class BungeeCord extends ProxyServer
{ {
getConsole().sendMessage( message ); getConsole().sendMessage( message );
// TODO: Here too // TODO: Here too
broadcast( new Packet3Chat( "{\"text\":\"" + message + "\"}" )); String encoded = BungeeCord.getInstance().gson.toJson( message );
broadcast( new Packet3Chat( "{\"text\":" + encoded + "}" ) );
} }
public void addConnection(UserConnection con) public void addConnection(UserConnection con)

View File

@ -266,7 +266,8 @@ public final class UserConnection implements ProxiedPlayer
public void sendMessage(String message) public void sendMessage(String message)
{ {
// TODO: Fix this // TODO: Fix this
unsafe().sendPacket( new Packet3Chat( "{\"text\":\"" + message + "\"}" ) ); String encoded = BungeeCord.getInstance().gson.toJson( message );
unsafe().sendPacket( new Packet3Chat( "{\"text\":" + encoded + "}" ) );
} }
@Override @Override

View File

@ -41,7 +41,6 @@ public class CommandAlert extends Command
String message = builder.substring( 0, builder.length() - 1 ); String message = builder.substring( 0, builder.length() - 1 );
ProxyServer.getInstance().broadcast( message ); ProxyServer.getInstance().broadcast( message );
ProxyServer.getInstance().getConsole().sendMessage( message );
} }
} }
} }