From ecbf3e9722c2f1657cedefe4e0c2b7aa7baba3cd Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 1 Dec 2019 09:33:12 +0000 Subject: [PATCH] GamemodeCommand: fix CommandSender assignment causing troubles for type inference on static analyzers this would never crash, but in strongly typed code it would be a compile failure. --- src/pocketmine/command/defaults/GamemodeCommand.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/command/defaults/GamemodeCommand.php b/src/pocketmine/command/defaults/GamemodeCommand.php index 063993aee4..6070d7866c 100644 --- a/src/pocketmine/command/defaults/GamemodeCommand.php +++ b/src/pocketmine/command/defaults/GamemodeCommand.php @@ -60,7 +60,6 @@ class GamemodeCommand extends VanillaCommand{ return true; } - $target = $sender; if(isset($args[1])){ $target = $sender->getServer()->getPlayer($args[1]); if($target === null){ @@ -68,7 +67,9 @@ class GamemodeCommand extends VanillaCommand{ return true; } - }elseif(!($sender instanceof Player)){ + }elseif($sender instanceof Player){ + $target = $sender; + }else{ throw new InvalidCommandSyntaxException(); }