Fix changing players' gamemodes from the console (#3590)

Fixes #3587 which was introduced by #3337.
This commit is contained in:
Josh Roy 2020-08-21 11:37:54 -04:00 committed by GitHub
parent 2c462106bc
commit 1133770aeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -26,7 +26,7 @@ public class Commandgamemode extends EssentialsLoopCommand {
} else if (args.length == 1) {
loopOnlinePlayersConsumer(server, sender, false, true, args[0], user -> setUserGamemode(sender, matchGameMode(commandLabel), user));
} else if (args.length == 2) {
loopOnlinePlayersConsumer(server, sender, false, true, args[1], user -> setUserGamemode(sender, matchGameMode(commandLabel), user));
loopOnlinePlayersConsumer(server, sender, false, true, args[1], user -> setUserGamemode(sender, matchGameMode(args[0]), user));
}
}
@ -85,6 +85,7 @@ public class Commandgamemode extends EssentialsLoopCommand {
private GameMode matchGameMode(String modeString) throws NotEnoughArgumentsException {
GameMode mode = null;
modeString = modeString.toLowerCase();
if (modeString.equalsIgnoreCase("gmc") || modeString.equalsIgnoreCase("egmc") || modeString.contains("creat") || modeString.equalsIgnoreCase("1") || modeString.equalsIgnoreCase("c")) {
mode = GameMode.CREATIVE;
} else if (modeString.equalsIgnoreCase("gms") || modeString.equalsIgnoreCase("egms") || modeString.contains("survi") || modeString.equalsIgnoreCase("0") || modeString.equalsIgnoreCase("s")) {