diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-10-02 21:06:28 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-10-02 21:06:28 +0100 |
commit | 9b881078979c7d633ebe14e74f574adacfa40a67 (patch) | |
tree | e8f7cdd92cb7afb63f9411393f00d8b279c44351 | |
parent | 147a2fc227197a731180ceb3de5de90a9ace4710 (diff) | |
download | Essentials-9b881078979c7d633ebe14e74f574adacfa40a67.tar Essentials-9b881078979c7d633ebe14e74f574adacfa40a67.tar.gz Essentials-9b881078979c7d633ebe14e74f574adacfa40a67.tar.lz Essentials-9b881078979c7d633ebe14e74f574adacfa40a67.tar.xz Essentials-9b881078979c7d633ebe14e74f574adacfa40a67.zip |
Fix gamemode other perm check
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index 85aeaa673..9f38eb5ae 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -41,18 +41,25 @@ public class Commandgamemode extends EssentialsCommand gamemodeOtherPlayers(server, user, gameMode, args[1]); return; } - else + else { - try { + try + { gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH)); } - catch (NotEnoughArgumentsException e) { - gameMode = matchGameMode(commandLabel); - gamemodeOtherPlayers(server, user, gameMode, args[0]); - return; + catch (NotEnoughArgumentsException e) + { + if (user.isAuthorized("essentials.gamemode.others")) + { + gameMode = matchGameMode(commandLabel); + gamemodeOtherPlayers(server, user, gameMode, args[0]); + return; + } + throw new NotEnoughArgumentsException(); } } - if (gameMode == null) { + if (gameMode == null) + { gameMode = user.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : user.getGameMode() == GameMode.CREATIVE ? GameMode.ADVENTURE : GameMode.SURVIVAL; } user.setGameMode(gameMode); @@ -104,11 +111,12 @@ public class Commandgamemode extends EssentialsCommand mode = GameMode.ADVENTURE; } else if (modeString.equalsIgnoreCase("gmt") || modeString.equalsIgnoreCase("egmt") - || modeString.contains("toggle") || modeString.contains("cycle") || modeString.equalsIgnoreCase("t")) + || modeString.contains("toggle") || modeString.contains("cycle") || modeString.equalsIgnoreCase("t")) { mode = null; } - else { + else + { throw new NotEnoughArgumentsException(); } return mode; |