Fix gamemodes not fully applying on server switch (#1348)

* Fix gamemodes not fully applying on server switch

* Revert previous commit and move session flag updating to the adventure settings method
This commit is contained in:
rtm516 2020-09-28 22:43:50 +01:00 committed by GitHub
parent d9b05f5b72
commit 7c49391b9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -729,6 +729,10 @@ public class GeyserSession implements CommandSender {
// Required to make command blocks destroyable
adventureSettingsPacket.setPlayerPermission(opPermissionLevel >= 2 ? PlayerPermission.OPERATOR : PlayerPermission.MEMBER);
// Update the noClip and worldImmutable values based on the current gamemode
noClip = gameMode == GameMode.SPECTATOR;
worldImmutable = gameMode == GameMode.ADVENTURE || gameMode == GameMode.SPECTATOR;
Set<AdventureSetting> flags = new HashSet<>();
if (canFly) {
flags.add(AdventureSetting.MAY_FLY);

View file

@ -103,8 +103,6 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
case CHANGE_GAMEMODE:
GameMode gameMode = (GameMode) packet.getValue();
session.setNoClip(gameMode == GameMode.SPECTATOR);
session.setWorldImmutable(gameMode == GameMode.ADVENTURE || gameMode == GameMode.SPECTATOR);
session.sendAdventureSettings();
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();