From 5d2b0acfc862f44f4cde96d1d705a1ede4c8e4fd Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 22 Dec 2022 18:38:10 +0000 Subject: [PATCH] GamemodeCommand: report failure if the target's game mode is already the desired game mode this has irritated me for years. --- src/command/defaults/GamemodeCommand.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/command/defaults/GamemodeCommand.php b/src/command/defaults/GamemodeCommand.php index 1363d34dc..81d4fd3f8 100644 --- a/src/command/defaults/GamemodeCommand.php +++ b/src/command/defaults/GamemodeCommand.php @@ -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()));