mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix Redudant Gamemode Code
This commit is contained in:
parent
ebd1e502f2
commit
fc50242c47
2 changed files with 2 additions and 16 deletions
|
@ -43,14 +43,7 @@ public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacke
|
|||
bedrockPacket.setUniqueEntityId(packet.getEntityId());
|
||||
session.getUpstream().sendPacketImmediately(bedrockPacket);
|
||||
|
||||
int gamemode = 0;
|
||||
if (packet.getGameMode().equals(GameMode.CREATIVE)) {
|
||||
gamemode = 1;
|
||||
} else if (packet.getGameMode().equals(GameMode.ADVENTURE)) {
|
||||
gamemode = 2;
|
||||
} else if (packet.getGameMode().equals(GameMode.SPECTATOR)) {
|
||||
gamemode = 3;
|
||||
}
|
||||
int gamemode = packet.getGameMode().ordinal();
|
||||
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();
|
||||
playerGameTypePacket.setGamemode(gamemode);
|
||||
|
||||
|
|
|
@ -57,14 +57,7 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
|
|||
session.getUpstream().sendPacket(stopRainPacket);
|
||||
break;
|
||||
case CHANGE_GAMEMODE:
|
||||
int gamemode = 0;
|
||||
if (packet.getValue().equals(GameMode.CREATIVE)) {
|
||||
gamemode = 1;
|
||||
} else if (packet.getValue().equals(GameMode.ADVENTURE)) {
|
||||
gamemode = 2;
|
||||
} else if (packet.getValue().equals(GameMode.SPECTATOR)) {
|
||||
gamemode = 3;
|
||||
}
|
||||
int gamemode = ((GameMode) packet.getValue()).ordinal();
|
||||
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();
|
||||
playerGameTypePacket.setGamemode(gamemode);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue