Constrain dimension to String|Integer
Fixes 1.8 server switch issues
This commit is contained in:
parent
739b496bf6
commit
b41e9be4c9
@ -74,7 +74,7 @@ public class Login extends DefinedPacket
|
|||||||
dimension = buf.readInt();
|
dimension = buf.readInt();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
dimension = buf.readByte();
|
dimension = (int) buf.readByte();
|
||||||
}
|
}
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_15 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_15 )
|
||||||
{
|
{
|
||||||
@ -138,10 +138,10 @@ public class Login extends DefinedPacket
|
|||||||
writeString( worldName, buf );
|
writeString( worldName, buf );
|
||||||
} else if ( protocolVersion > ProtocolConstants.MINECRAFT_1_9 )
|
} else if ( protocolVersion > ProtocolConstants.MINECRAFT_1_9 )
|
||||||
{
|
{
|
||||||
buf.writeInt( ( (Number) dimension ).intValue() );
|
buf.writeInt( (Integer) dimension );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
buf.writeByte( ( (Number) dimension ).byteValue() );
|
buf.writeByte( (Integer) dimension );
|
||||||
}
|
}
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_15 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_15 )
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ public class Respawn extends DefinedPacket
|
|||||||
writeString( worldName, buf );
|
writeString( worldName, buf );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
buf.writeInt( ( (Number) dimension ).intValue() );
|
buf.writeInt( ( (Integer) dimension ) );
|
||||||
}
|
}
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_15 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_15 )
|
||||||
{
|
{
|
||||||
|
@ -263,12 +263,12 @@ public class ServerConnector extends PacketHandler
|
|||||||
{
|
{
|
||||||
Object newDim;
|
Object newDim;
|
||||||
String worldName = login.getWorldName();
|
String worldName = login.getWorldName();
|
||||||
if ( login.getDimension() instanceof Number )
|
if ( login.getDimension() instanceof Integer )
|
||||||
{
|
{
|
||||||
newDim = ( ( (Number) login.getDimension() ).intValue() >= 0 ? -1 : 0 );
|
newDim = ( (Integer) login.getDimension() >= 0 ? -1 : 0 );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
newDim = worldName = ( "minecraft:overworld".equals( login.getDimension() ) ) ? "minecraft:the_nether" : "minecraft:overworld";
|
newDim = worldName = ( "minecraft:overworld".equals( (String) login.getDimension() ) ) ? "minecraft:the_nether" : "minecraft:overworld";
|
||||||
}
|
}
|
||||||
|
|
||||||
user.unsafe().sendPacket( new Respawn( newDim, worldName, login.getSeed(), login.getDifficulty(), login.getGameMode(), login.getPreviousGameMode(), login.getLevelType(), login.isDebug(), login.isFlat(), false ) );
|
user.unsafe().sendPacket( new Respawn( newDim, worldName, login.getSeed(), login.getDifficulty(), login.getGameMode(), login.getPreviousGameMode(), login.getLevelType(), login.isDebug(), login.isFlat(), false ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user