Reject clients on other protocol versions.
This commit is contained in:
parent
0f7da279ef
commit
13f1fa7443
@ -39,6 +39,7 @@ import net.md_5.bungee.netty.PacketDecoder;
|
|||||||
import net.md_5.bungee.netty.PacketHandler;
|
import net.md_5.bungee.netty.PacketHandler;
|
||||||
import net.md_5.bungee.netty.PipelineUtils;
|
import net.md_5.bungee.netty.PipelineUtils;
|
||||||
import net.md_5.bungee.protocol.Forge;
|
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.DefinedPacket;
|
||||||
import net.md_5.bungee.protocol.packet.Packet1Login;
|
import net.md_5.bungee.protocol.packet.Packet1Login;
|
||||||
import net.md_5.bungee.protocol.packet.Packet2Handshake;
|
import net.md_5.bungee.protocol.packet.Packet2Handshake;
|
||||||
@ -142,6 +143,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
this.handshake = handshake;
|
this.handshake = handshake;
|
||||||
bungee.getLogger().log( Level.INFO, "{0} has connected", this );
|
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 )
|
if ( handshake.getUsername().length() > 16 )
|
||||||
{
|
{
|
||||||
disconnect( "Cannot have username longer than 16 characters" );
|
disconnect( "Cannot have username longer than 16 characters" );
|
||||||
|
Loading…
Reference in New Issue
Block a user