forked from GeyserMC/Geyser
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:
parent
d9b05f5b72
commit
7c49391b9d
2 changed files with 4 additions and 2 deletions
|
@ -729,6 +729,10 @@ public class GeyserSession implements CommandSender {
|
||||||
// Required to make command blocks destroyable
|
// Required to make command blocks destroyable
|
||||||
adventureSettingsPacket.setPlayerPermission(opPermissionLevel >= 2 ? PlayerPermission.OPERATOR : PlayerPermission.MEMBER);
|
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<>();
|
Set<AdventureSetting> flags = new HashSet<>();
|
||||||
if (canFly) {
|
if (canFly) {
|
||||||
flags.add(AdventureSetting.MAY_FLY);
|
flags.add(AdventureSetting.MAY_FLY);
|
||||||
|
|
|
@ -103,8 +103,6 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
|
||||||
case CHANGE_GAMEMODE:
|
case CHANGE_GAMEMODE:
|
||||||
GameMode gameMode = (GameMode) packet.getValue();
|
GameMode gameMode = (GameMode) packet.getValue();
|
||||||
|
|
||||||
session.setNoClip(gameMode == GameMode.SPECTATOR);
|
|
||||||
session.setWorldImmutable(gameMode == GameMode.ADVENTURE || gameMode == GameMode.SPECTATOR);
|
|
||||||
session.sendAdventureSettings();
|
session.sendAdventureSettings();
|
||||||
|
|
||||||
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();
|
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();
|
||||||
|
|
Loading…
Reference in a new issue