GamemodeCommand: report failure if the target's game mode is already the desired game mode

this has irritated me for years.
This commit is contained in:
Dylan K. Taylor 2022-12-22 18:38:10 +00:00
parent 7d1d62042c
commit 5d2b0acfc8
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -72,6 +72,11 @@ class GamemodeCommand extends VanillaCommand{
throw new InvalidCommandSyntaxException();
}
if($target->getGamemode()->equals($gameMode)){
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_gamemode_failure($target->getName()));
return true;
}
$target->setGamemode($gameMode);
if(!$gameMode->equals($target->getGamemode())){
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_gamemode_failure($target->getName()));