mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-27 11:37:38 +01:00
Add gamemode check when game moding self.
This commit is contained in:
parent
6c38b6c6fb
commit
ee2018416e
@ -53,9 +53,16 @@ public class Commandgamemode extends EssentialsCommand {
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
}
|
||||
|
||||
if (gameMode == null) {
|
||||
gameMode = user.getBase().getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : user.getBase().getGameMode() == GameMode.CREATIVE ? GameMode.ADVENTURE : GameMode.SURVIVAL;
|
||||
}
|
||||
|
||||
if (!canChangeToMode(user.getBase(), gameMode)) {
|
||||
user.sendMessage(tl("cantGamemode", gameMode.name()));
|
||||
return;
|
||||
}
|
||||
|
||||
user.getBase().setGameMode(gameMode);
|
||||
user.sendMessage(tl("gameMode", tl(user.getBase().getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user