mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-23 00:55:57 +00:00
/give now checks correctly
This commit is contained in:
parent
a3b7f12803
commit
2763401be3
@ -129,7 +129,7 @@ class BlockAPI{
|
||||
$output .= "Usage: /give <username> <item> [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";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user