From 691712aaa4aacf3934c15f0d4912426edf4bbd5b Mon Sep 17 00:00:00 2001 From: glorydark <1083215364@qq.com> Date: Wed, 21 Feb 2024 04:17:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E6=AC=A1=E4=BF=AE=E6=94=B9=EF=BC=9A?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A8=A1=E5=BC=8F=E8=BF=98=E5=8E=9F=E5=88=B0?= =?UTF-8?q?=E7=BB=99=E4=BA=88=E6=9D=83=E9=99=90=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glorydark/DLevelEventPlus/CheckTask.java | 6 +----- .../DLevelEventPlus/api/PermissionAPI.java | 18 +++++++++--------- 2 files changed, 10 insertions(+), 14 deletions(-) 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));