mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 11:45:30 +00:00
Rewrote a bit of Player::teleport()
This commit is contained in:
parent
f7abb6f909
commit
e0390d0f54
@ -718,13 +718,12 @@ class Player{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newlevel = false;
|
|
||||||
if($pos instanceof Position and $pos->level !== $this->level){
|
if($pos instanceof Position and $pos->level !== $this->level){
|
||||||
$newLevel = true;
|
|
||||||
if($this->server->api->dhandle("player.teleport.level", array("player" => $this, "origin" => $this->level, "target" => $pos->level)) === false){
|
if($this->server->api->dhandle("player.teleport.level", array("player" => $this, "origin" => $this->level, "target" => $pos->level)) === false){
|
||||||
$this->entity->check = true;
|
$this->entity->check = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($this->server->api->entity->getAll($this->level) as $e){
|
foreach($this->server->api->entity->getAll($this->level) as $e){
|
||||||
if($e !== $this->entity){
|
if($e !== $this->entity){
|
||||||
if($e->player instanceof Player){
|
if($e->player instanceof Player){
|
||||||
@ -763,16 +762,8 @@ class Player{
|
|||||||
));
|
));
|
||||||
$terrain = true;
|
$terrain = true;
|
||||||
|
|
||||||
if($newLevel === true){
|
foreach($this->server->api->player->getAll($this->level) as $player){
|
||||||
foreach($this->server->api->player->getAll($this->level) as $player){
|
if($player !== $this and $player->entity instanceof Entity){
|
||||||
$player->dataPacket(MC_MOVE_ENTITY_POSROT, array(
|
|
||||||
"eid" => $this->entity->eid,
|
|
||||||
"x" => $pos->x,
|
|
||||||
"y" => $pos->y,
|
|
||||||
"z" => $pos->z,
|
|
||||||
"yaw" => $yaw,
|
|
||||||
"pitch" => $pitch,
|
|
||||||
));
|
|
||||||
$this->dataPacket(MC_MOVE_ENTITY_POSROT, array(
|
$this->dataPacket(MC_MOVE_ENTITY_POSROT, array(
|
||||||
"eid" => $player->entity->eid,
|
"eid" => $player->entity->eid,
|
||||||
"x" => $player->entity->x,
|
"x" => $player->entity->x,
|
||||||
@ -798,6 +789,7 @@ class Player{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->lastCorrect = $pos;
|
$this->lastCorrect = $pos;
|
||||||
$this->entity->fallY = false;
|
$this->entity->fallY = false;
|
||||||
$this->entity->fallStart = false;
|
$this->entity->fallStart = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user