Improve player matching in /gamemode

Add extra aliases to /gamemode
This commit is contained in:
KHobbits 2012-08-12 01:12:10 +01:00
parent bdf67db6ed
commit f17a790d78
3 changed files with 15 additions and 3 deletions

View file

@ -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

View file

@ -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"));
}
}

View file

@ -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]