Reject clients on other protocol versions.

This commit is contained in:
AgentK 2013-06-21 02:24:47 -03:00 committed by md_5
parent 0f7da279ef
commit 13f1fa7443

View File

@ -39,6 +39,7 @@ import net.md_5.bungee.netty.PacketDecoder;
import net.md_5.bungee.netty.PacketHandler;
import net.md_5.bungee.netty.PipelineUtils;
import net.md_5.bungee.protocol.Forge;
import net.md_5.bungee.protocol.Vanilla;
import net.md_5.bungee.protocol.packet.DefinedPacket;
import net.md_5.bungee.protocol.packet.Packet1Login;
import net.md_5.bungee.protocol.packet.Packet2Handshake;
@ -142,6 +143,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection
this.handshake = handshake;
bungee.getLogger().log( Level.INFO, "{0} has connected", this );
if ( handshake.getProcolVersion() > Vanilla.PROTOCOL_VERSION )
{
disconnect( "Outdated server!" );
} else if ( handshake.getProcolVersion() < Vanilla.PROTOCOL_VERSION )
{
disconnect( "Outdated client!" );
}
if ( handshake.getUsername().length() > 16 )
{
disconnect( "Cannot have username longer than 16 characters" );