Fix kicks + don't allow connections to online mode servers

This commit is contained in:
md_5 2013-10-27 18:12:18 +11:00
parent 2129cb3614
commit e006673550
2 changed files with 8 additions and 1 deletions

View File

@ -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
{

View File

@ -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 )
{