Fix gamemode other perm check

This commit is contained in:
KHobbits 2012-10-02 21:06:28 +01:00
parent 147a2fc227
commit 9b88107897

View file

@ -43,16 +43,23 @@ public class Commandgamemode extends EssentialsCommand
} }
else else
{ {
try { try
{
gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH)); gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH));
} }
catch (NotEnoughArgumentsException e) { catch (NotEnoughArgumentsException e)
gameMode = matchGameMode(commandLabel); {
gamemodeOtherPlayers(server, user, gameMode, args[0]); if (user.isAuthorized("essentials.gamemode.others"))
return; {
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; gameMode = user.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : user.getGameMode() == GameMode.CREATIVE ? GameMode.ADVENTURE : GameMode.SURVIVAL;
} }
user.setGameMode(gameMode); user.setGameMode(gameMode);
@ -104,11 +111,12 @@ public class Commandgamemode extends EssentialsCommand
mode = GameMode.ADVENTURE; mode = GameMode.ADVENTURE;
} }
else if (modeString.equalsIgnoreCase("gmt") || modeString.equalsIgnoreCase("egmt") 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; mode = null;
} }
else { else
{
throw new NotEnoughArgumentsException(); throw new NotEnoughArgumentsException();
} }
return mode; return mode;