From 2763401be3dd2445c895e24fdf861a6ada0c46a5 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Tue, 9 Apr 2013 20:44:57 +0200 Subject: [PATCH] /give now checks correctly --- src/API/BlockAPI.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 9e3cbbf3..33c00b00 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -129,7 +129,7 @@ class BlockAPI{ $output .= "Usage: /give [amount] [damage]\n"; break; } - $username = $params[0]; + $player = $this->server->api->player->get($params[0]); $item = BlockAPI::fromString($params[1]); if(!isset($params[2])){ @@ -138,9 +138,9 @@ class BlockAPI{ $item->count = (int) $params[2]; } - if(($player = $this->server->api->player->get($username)) !== false){ + if($player instanceof Player){ $this->drop(new Vector3($player->entity->x - 0.5, $player->entity->y, $player->entity->z - 0.5), $item, true); - $output .= "Giving ".$item->count." of ".$item->getName()." (".$item->getID().":".$item->getMetadata().") to ".$username."\n"; + $output .= "Giving ".$item->count." of ".$item->getName()." (".$item->getID().":".$item->getMetadata().") to ".$player->username."\n"; }else{ $output .= "Unknown player\n"; }