From febfbb19c4fbc31f1b57bafc11ef7b8c10ba2bc0 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Fri, 5 Apr 2013 14:09:02 +0200 Subject: [PATCH] Updated /gamemode command to follow Minecraft structure --- src/API/PlayerAPI.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/API/PlayerAPI.php b/src/API/PlayerAPI.php index bf5a11ec..cd50adca 100644 --- a/src/API/PlayerAPI.php +++ b/src/API/PlayerAPI.php @@ -122,7 +122,6 @@ class PlayerAPI{ $output .= "Lag: ".round($issuer->getLag(), 2)."\n"; break; case "gamemode": - $gm = -1; $player = false; $gms = array( "0" => SURVIVAL, @@ -135,18 +134,17 @@ class PlayerAPI{ "adventure" => ADVENTURE, "a" => ADVENTURE, ); - if(!isset($params[1]) and isset($params[0]) and ($issuer instanceof Player)){ + if($issuer instanceof Player){ $player = $issuer; - }elseif(isset($params[1]) and isset($params[0])){ + } + if(isset($params[1])){ $player = $this->server->api->player->get($params[0]); } - if(!($player instanceof Player) or !isset($gms[strtolower($params[1])])){ - $output .= "Usage: /gamemode [player] \n"; + if(!($player instanceof Player) or !isset($gms[strtolower($params[0])])){ + $output .= "Usage: /gamemode [player]\n"; break; } - - - if($player->setGamemode($gms[strtolower($params[1])])){ + if($player->setGamemode($gms[strtolower($params[0])])){ $output .= "Gamemode of ".$player->username." changed to ".$player->getGamemode()."\n"; } break;