diff --git a/src/main/java/glorydark/DLevelEventPlus/CheckTask.java b/src/main/java/glorydark/DLevelEventPlus/CheckTask.java index e994652..0d4a8a6 100644 --- a/src/main/java/glorydark/DLevelEventPlus/CheckTask.java +++ b/src/main/java/glorydark/DLevelEventPlus/CheckTask.java @@ -38,14 +38,12 @@ public void onRun(int i) { } } if (PermissionAPI.isAdmin(player)) { - player.setGamemode(Server.getInstance().getDefaultGamemode()); if (player.isImmobile()) { player.setImmobile(false); } return; } if (PermissionAPI.isOperator(player, player.getLevel())) { - player.setGamemode(Server.getInstance().getDefaultGamemode()); if (player.isImmobile()) { player.setImmobile(false); } @@ -68,9 +66,7 @@ public void onRun(int i) { player.setImmobile(!movable); } } - if (forceGamemode != -1) { - player.setGamemode(forceGamemode); - } + player.setGamemode(forceGamemode); } } } diff --git a/src/main/java/glorydark/DLevelEventPlus/api/PermissionAPI.java b/src/main/java/glorydark/DLevelEventPlus/api/PermissionAPI.java index 49b4e62..57da9e0 100644 --- a/src/main/java/glorydark/DLevelEventPlus/api/PermissionAPI.java +++ b/src/main/java/glorydark/DLevelEventPlus/api/PermissionAPI.java @@ -23,15 +23,6 @@ public static void whiteList(CommandSender sender, OperatePermissionType type, S worldcfg.set(levelname, arrayList); worldcfg.save(); if (player != null) { - Level level = player.getLevel(); - Object forceGameModeObj = LevelSettingsAPI.getLevelObjectSetting(level.getName(), "World", "ForceGameMode"); - int forceGamemode = -1; - if (forceGameModeObj != null) { - forceGamemode = Server.getGamemodeFromString(forceGameModeObj.toString()); - } - if (player.getGamemode() == forceGamemode) { - player.setGamemode(Server.getInstance().getDefaultGamemode()); - } player.sendMessage(LevelEventPlusMain.language.translateString("tip_whitelist_add_success_receiver", playerName, levelname)); } sender.sendMessage(LevelEventPlusMain.language.translateString("tip_whitelist_add_success", playerName, levelname)); @@ -111,6 +102,15 @@ public static void operatorList(CommandSender sender, OperatePermissionType type worldcfg.set(levelname, arrayList); worldcfg.save(); if (player != null) { + Level level = player.getLevel(); + Object forceGameModeObj = LevelSettingsAPI.getLevelObjectSetting(level.getName(), "World", "ForceGameMode"); + int forceGamemode = -1; + if (forceGameModeObj != null) { + forceGamemode = Server.getGamemodeFromString(forceGameModeObj.toString()); + } + if (player.getGamemode() == forceGamemode) { + player.setGamemode(Server.getInstance().getDefaultGamemode()); + } player.sendMessage(LevelEventPlusMain.language.translateString("tip_operator_add_success_receiver", playerName, levelname)); } sender.sendMessage(LevelEventPlusMain.language.translateString("tip_operator_add_success", playerName, levelname));