mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-12 16:51:00 -05:00
Check for negative GameModes in ServerPlayerListEntryPacket
These are sometimes negative for some reason. I was only able to reproduce this on one server, but this fixed it. The server was sending out a GameMode of -1.
This commit is contained in:
parent
8b1b94cb7c
commit
27baf233c9
1 changed files with 4 additions and 2 deletions
|
@ -63,7 +63,8 @@ public class ServerPlayerListEntryPacket implements Packet {
|
||||||
profile.getProperties().add(new GameProfile.Property(propertyName, value, signature));
|
profile.getProperties().add(new GameProfile.Property(propertyName, value, signature));
|
||||||
}
|
}
|
||||||
|
|
||||||
GameMode gameMode = MagicValues.key(GameMode.class, in.readVarInt());
|
int g = in.readVarInt();
|
||||||
|
GameMode gameMode = MagicValues.key(GameMode.class, g < 0 ? 0 : g);
|
||||||
int ping = in.readVarInt();
|
int ping = in.readVarInt();
|
||||||
Message displayName = null;
|
Message displayName = null;
|
||||||
if(in.readBoolean()) {
|
if(in.readBoolean()) {
|
||||||
|
@ -73,7 +74,8 @@ public class ServerPlayerListEntryPacket implements Packet {
|
||||||
entry = new PlayerListEntry(profile, gameMode, ping, displayName);
|
entry = new PlayerListEntry(profile, gameMode, ping, displayName);
|
||||||
break;
|
break;
|
||||||
case UPDATE_GAMEMODE:
|
case UPDATE_GAMEMODE:
|
||||||
GameMode mode = MagicValues.key(GameMode.class, in.readVarInt());
|
g = in.readVarInt();
|
||||||
|
GameMode mode = MagicValues.key(GameMode.class, g < 0 ? 0 : g);
|
||||||
entry = new PlayerListEntry(profile, mode);
|
entry = new PlayerListEntry(profile, mode);
|
||||||
break;
|
break;
|
||||||
case UPDATE_LATENCY:
|
case UPDATE_LATENCY:
|
||||||
|
|
Loading…
Reference in a new issue