diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index 8440cb0b8..ec2f4aaad 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -29,16 +29,16 @@ public class Commandgamemode extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - if(args.length < 1) + if (args.length < 1) { throw new NotEnoughArgumentsException(); } - + if (args.length > 1 && args[0].trim().length() > 2 && user.isAuthorized("essentials.gamemode.others")) { gamemodeOtherPlayers(server, user, args); return; - } + } performSetMode(args[0], user); user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName())); } @@ -51,25 +51,25 @@ public class Commandgamemode extends EssentialsCommand if (player.isHidden()) { continue; - } + } performSetMode(args[0], player); sender.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName())); } } - + private void performSetMode(String mode, Player player) { - if (mode.contains("survi") || mode.equalsIgnoreCase("0") || mode.equalsIgnoreCase("s")) - { - player.setGameMode(GameMode.SURVIVAL); - } - else if (mode.contains("creat") || mode.equalsIgnoreCase("1") || mode.equalsIgnoreCase("c")) - { - player.setGameMode(GameMode.CREATIVE); - } - else if (mode.contains("advent") || mode.equalsIgnoreCase("2") || mode.equalsIgnoreCase("a")) - { - player.setGameMode(GameMode.ADVENTURE); - } + if (mode.contains("survi") || mode.equalsIgnoreCase("0") || mode.equalsIgnoreCase("s")) + { + player.setGameMode(GameMode.SURVIVAL); + } + else if (mode.contains("creat") || mode.equalsIgnoreCase("1") || mode.equalsIgnoreCase("c")) + { + player.setGameMode(GameMode.CREATIVE); + } + else if (mode.contains("advent") || mode.equalsIgnoreCase("2") || mode.equalsIgnoreCase("a")) + { + player.setGameMode(GameMode.ADVENTURE); + } } } \ No newline at end of file