summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-08-12 01:12:10 +0100
committerKHobbits <rob@khobbits.co.uk>2012-08-12 01:12:10 +0100
commit3a115000c90ed916fe9c6b9fdee41e476a2781e8 (patch)
treea7344900919041e03b4d8b07b995e0e1d09e5d83
parent0a72669ac79b3f94a75861555936064f9eba86b5 (diff)
downloadEssentials-3a115000c90ed916fe9c6b9fdee41e476a2781e8.tar
Essentials-3a115000c90ed916fe9c6b9fdee41e476a2781e8.tar.gz
Essentials-3a115000c90ed916fe9c6b9fdee41e476a2781e8.tar.lz
Essentials-3a115000c90ed916fe9c6b9fdee41e476a2781e8.tar.xz
Essentials-3a115000c90ed916fe9c6b9fdee41e476a2781e8.zip
Improve player matching in /gamemode
Add extra aliases to /gamemode
-rw-r--r--Essentials/nbproject/project.properties2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java14
-rw-r--r--Essentials/src/plugin.yml2
3 files changed, 15 insertions, 3 deletions
diff --git a/Essentials/nbproject/project.properties b/Essentials/nbproject/project.properties
index 7a5ffe7bb..a9cebbb92 100644
--- a/Essentials/nbproject/project.properties
+++ b/Essentials/nbproject/project.properties
@@ -1,5 +1,5 @@
annotation.processing.enabled=true
-annotation.processing.enabled.in.editor=false
+annotation.processing.enabled.in.editor=true
annotation.processing.processors.list=lombok.core.AnnotationProcessor
annotation.processing.run.all.processors=false
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java
index 39f7d936a..5fb1a11ba 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java
@@ -43,8 +43,15 @@ public class Commandgamemode extends EssentialsCommand
user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
}
- private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final String[] args)
+ private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final String[] args) throws NotEnoughArgumentsException
{
+ //TODO: TL this
+ if (args[1].trim().length() < 2)
+ {
+ throw new NotEnoughArgumentsException("You need to specify a valid player/mode.");
+ }
+
+ boolean foundUser = false;
for (Player matchPlayer : server.matchPlayer(args[1]))
{
final User player = ess.getUser(matchPlayer);
@@ -54,6 +61,11 @@ public class Commandgamemode extends EssentialsCommand
}
performSetMode(args[0].toLowerCase(Locale.ENGLISH), player);
sender.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName()));
+ foundUser = true;
+ }
+ if (!foundUser)
+ {
+ throw new NotEnoughArgumentsException(_("playerNotFound"));
}
}
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index 98af00ea3..813e0d774 100644
--- a/Essentials/src/plugin.yml
+++ b/Essentials/src/plugin.yml
@@ -118,7 +118,7 @@ commands:
gamemode:
description: Change player gamemode.
usage: /<command> <survival|creative|adventure> [player]
- aliases: [gm,creative,creativemode,egamemode,ecreative,ecreativemode,egm]
+ aliases: [gm,creative,creativemode,survival,survivalmode,adventure,adventuremode,gmc,gma,gms,egamemod,eecreative,ecreativemode,esurvival,esurvivalmode,eadventure,eadventuremode,egmc,egma,egms,egm]
getpos:
description: Get your current coordinates or those of a player.
usage: /<command> [player]