Improved player movement event firing & corrections

This commit is contained in:
Shoghi Cervantes 2014-10-14 00:11:17 +02:00
parent 464afb949e
commit 6e8144d5d9
2 changed files with 6 additions and 2 deletions

View File

@ -1121,7 +1121,11 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$revert = true;
//$this->server->getLogger()->warning($this->getName()." moved wrongly!");
}elseif($diff > 0){
$revert = !$this->setPosition($this->newPosition);
$this->x = $this->newPosition->x;
$this->y = $this->newPosition->y;
$this->z = $this->newPosition->z;
$radius = $this->width / 2;
$this->boundingBox->setBounds($this->x - $radius, $this->y + $this->ySize, $this->z - $radius, $this->x + $radius, $this->y + $this->height + $this->ySize, $this->z + $radius);
}
}
}

View File

@ -1037,7 +1037,7 @@ abstract class Entity extends Position implements Metadatable{
}
public function setPosition(Vector3 $pos, $force = false){
if($pos instanceof Position and $pos->getLevel() instanceof Level and $pos->getLevel() !== $this->getLevel()){
if($pos instanceof Position and $pos->level instanceof Level and $pos->level !== $this->level){
if($this->switchLevel($pos->getLevel()) === false){
return false;
}