Skip to content

Commit

Permalink
Merge branch 'SpigotMC:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
SimplyRin committed Sep 22, 2024
2 parents 91ddb70 + acb85e3 commit 8a3a347
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class ProtocolConstants
public static final int MINECRAFT_1_20_3 = 765;
public static final int MINECRAFT_1_20_5 = 766;
public static final int MINECRAFT_1_21 = 767;
public static final int MINECRAFT_1_21_2 = 1073742032;
public static final int MINECRAFT_1_21_2 = 1073742034;
public static final List<String> SUPPORTED_VERSIONS;
public static final List<Integer> SUPPORTED_VERSION_IDS;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protoco
{
properties = readProperties( buf );
}
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 )
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 && protocolVersion < ProtocolConstants.MINECRAFT_1_21_2 )
{
// Whether the client should disconnect on its own if it receives invalid data from the server
buf.readBoolean();
Expand All @@ -59,7 +59,7 @@ public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protoc
{
writeProperties( properties, buf );
}
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 )
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 && protocolVersion < ProtocolConstants.MINECRAFT_1_21_2 )
{
// Whether the client should disconnect on its own if it receives invalid data from the server
// Vanilla sends true so we also send true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,15 @@ public void handle(PluginMessage pluginMessage) throws Exception
@Override
public void handle(LegacyHandshake legacyHandshake) throws Exception
{
Preconditions.checkState( !this.legacy, "Not expecting LegacyHandshake" );
this.legacy = true;
ch.close( bungee.getTranslation( "outdated_client", bungee.getGameVersion() ) );
}

@Override
public void handle(LegacyPing ping) throws Exception
{
Preconditions.checkState( !this.legacy, "Not expecting LegacyPing" );
this.legacy = true;
final boolean v1_5 = ping.isV1_5();

Expand Down Expand Up @@ -342,7 +344,7 @@ public void handle(PingPacket ping) throws Exception
@Override
public void handle(Handshake handshake) throws Exception
{
Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" );
Preconditions.checkState( thisState == State.HANDSHAKE && !this.legacy, "Not expecting HANDSHAKE" );
this.handshake = handshake;
ch.setVersion( handshake.getProtocolVersion() );
ch.getHandle().pipeline().remove( PipelineUtils.LEGACY_KICKER );
Expand Down Expand Up @@ -420,7 +422,7 @@ public void handle(Handshake handshake) throws Exception
@Override
public void handle(LoginRequest loginRequest) throws Exception
{
Preconditions.checkState( thisState == State.USERNAME, "Not expecting USERNAME" );
Preconditions.checkState( thisState == State.USERNAME && this.loginRequest == null, "Not expecting USERNAME" );

if ( !AllowedCharacters.isValidName( loginRequest.getData(), onlineMode ) )
{
Expand Down

0 comments on commit 8a3a347

Please sign in to comment.