mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +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";
|
$output .= "Usage: /give <username> <item> [amount] [damage]\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$username = $params[0];
|
$player = $this->server->api->player->get($params[0]);
|
||||||
$item = BlockAPI::fromString($params[1]);
|
$item = BlockAPI::fromString($params[1]);
|
||||||
|
|
||||||
if(!isset($params[2])){
|
if(!isset($params[2])){
|
||||||
@ -138,9 +138,9 @@ class BlockAPI{
|
|||||||
$item->count = (int) $params[2];
|
$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);
|
$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{
|
}else{
|
||||||
$output .= "Unknown player\n";
|
$output .= "Unknown player\n";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user