diff options
author | evonuts <git@clevo.net.nz> | 2012-11-08 15:19:07 +1300 |
---|---|---|
committer | evonuts <git@clevo.net.nz> | 2012-11-08 15:19:07 +1300 |
commit | 83120f707f207dc1402f9eab7942920e97c5c5b7 (patch) | |
tree | 5575a3bdd9e0b31ceed94189f5ff99258969cb90 | |
parent | 9d98edb4eebb5f23aea4a5f9cde5d45874f79a4e (diff) | |
download | Essentials-83120f707f207dc1402f9eab7942920e97c5c5b7.tar Essentials-83120f707f207dc1402f9eab7942920e97c5c5b7.tar.gz Essentials-83120f707f207dc1402f9eab7942920e97c5c5b7.tar.lz Essentials-83120f707f207dc1402f9eab7942920e97c5c5b7.tar.xz Essentials-83120f707f207dc1402f9eab7942920e97c5c5b7.zip |
Allow for console based gamemode shortcuts. Fixes ticket #3173
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index 9f38eb5ae..5b9b854cb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -19,12 +19,22 @@ public class Commandgamemode extends EssentialsCommand @Override protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { - if (args.length < 2) + GameMode gameMode; + if (args.length == 0) { throw new NotEnoughArgumentsException(); } - GameMode gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH)); - gamemodeOtherPlayers(server, sender, gameMode, args[1]); + else if (args.length == 1) + { + gameMode = matchGameMode(commandLabel); + gamemodeOtherPlayers(server, sender, gameMode, args[0]); + } + else if (args.length == 2) + { + gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH)); + gamemodeOtherPlayers(server, sender, gameMode, args[1]); + } + } @Override @@ -41,7 +51,7 @@ public class Commandgamemode extends EssentialsCommand gamemodeOtherPlayers(server, user, gameMode, args[1]); return; } - else + else { try { |