From e00667355092475490eda2d5a154799d73bcba61 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 27 Oct 2013 18:12:18 +1100 Subject: [PATCH] Fix kicks + don't allow connections to online mode servers --- proxy/src/main/java/net/md_5/bungee/ServerConnector.java | 7 +++++++ proxy/src/main/java/net/md_5/bungee/UserConnection.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java index d56e0f5e..6611d05c 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -23,6 +23,7 @@ import net.md_5.bungee.netty.PacketHandler; import net.md_5.bungee.protocol.MinecraftOutput; import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.Protocol; +import net.md_5.bungee.protocol.packet.EncryptionRequest; import net.md_5.bungee.protocol.packet.Login; import net.md_5.bungee.protocol.packet.Respawn; import net.md_5.bungee.protocol.packet.ScoreboardObjective; @@ -188,6 +189,12 @@ public class ServerConnector extends PacketHandler throw new CancelSendSignal(); } + @Override + public void handle(EncryptionRequest encryptionRequest) throws Exception + { + throw new RuntimeException( "Server is online mode!" ); + } + @Override public void handle(Kick kick) throws Exception { 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 0013a623..06c10109 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( reason ) ); + unsafe().sendPacket( new Kick( BungeeCord.getInstance().gson.toJson( reason ) ) ); ch.close(); if ( server != null ) {