diff options
author | snowleo <schneeleo@gmail.com> | 2012-08-03 10:39:45 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2012-08-03 10:39:45 +0200 |
commit | 45cd9597c9418a553ec8709592a21be1318f6acc (patch) | |
tree | 0437bd9a326072ab2d7391f7a2406ca748cbe3ff | |
parent | b40d663c7e9a243895f96318ac58ff06272795b3 (diff) | |
download | Essentials-45cd9597c9418a553ec8709592a21be1318f6acc.tar Essentials-45cd9597c9418a553ec8709592a21be1318f6acc.tar.gz Essentials-45cd9597c9418a553ec8709592a21be1318f6acc.tar.lz Essentials-45cd9597c9418a553ec8709592a21be1318f6acc.tar.xz Essentials-45cd9597c9418a553ec8709592a21be1318f6acc.zip |
Code cleanup
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java | 34 |
1 files changed, 17 insertions, 17 deletions
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 |