PlayerAPI teleport commands now return a correct name

This commit is contained in:
Shoghi Cervantes Pueyo 2013-04-23 12:42:43 +02:00
parent 2e4724c596
commit dffbfa0754

View File

@ -218,17 +218,19 @@ class PlayerAPI{
return $output;
}
public function teleport($name, $target){
$target = $this->get($target);
if(($target instanceof Player) and ($target->entity instanceof Entity)){
return $this->tppos($name, $target->entity->x, $target->entity->y, $target->entity->z);
public function teleport(&$name, &$target){
$player = $this->get($target);
if(($player instanceof Player) and ($player->entity instanceof Entity)){
$target = $player->username;
return $this->tppos($name, $player->entity->x, $player->entity->y, $player->entity->z);
}
return false;
}
public function tppos($name, $x, $y, $z){
public function tppos(&$name, $x, $y, $z){
$player = $this->get($name);
if(($player instanceof Player) and ($player->entity instanceof Entity)){
$name = $player->username;
$player->teleport(new Vector3($x, $y, $z));
return true;
}