mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-26 04:43:45 +00:00
Added player.teleport.level
This commit is contained in:
parent
dc22e1b81c
commit
588379a430
@ -612,17 +612,15 @@ class Player{
|
|||||||
$pitch = $this->entity->pitch;
|
$pitch = $this->entity->pitch;
|
||||||
}
|
}
|
||||||
if($this->server->api->dhandle("player.teleport", array("player" => $this, "target" => $pos)) === false){
|
if($this->server->api->dhandle("player.teleport", array("player" => $this, "target" => $pos)) === false){
|
||||||
|
$this->entity->check = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->lastCorrect = $pos;
|
|
||||||
$this->entity->fallY = false;
|
|
||||||
$this->entity->fallStart = false;
|
|
||||||
$this->entity->setPosition($pos, $yaw, $pitch);
|
|
||||||
$this->entity->resetSpeed();
|
|
||||||
$this->entity->updateLast();
|
|
||||||
$this->entity->calculateVelocity();
|
|
||||||
if($pos instanceof Position and $pos->level !== $this->level){
|
if($pos instanceof Position and $pos->level !== $this->level){
|
||||||
|
if($this->server->api->dhandle("player.teleport.level", array("player" => $this, "origin" => $this->level, "target" => $pos->level)) === false){
|
||||||
|
$this->entity->check = true;
|
||||||
|
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){
|
||||||
@ -642,6 +640,13 @@ class Player{
|
|||||||
$this->server->api->entity->spawnAll($this);
|
$this->server->api->entity->spawnAll($this);
|
||||||
$terrain = true;
|
$terrain = true;
|
||||||
}
|
}
|
||||||
|
$this->lastCorrect = $pos;
|
||||||
|
$this->entity->fallY = false;
|
||||||
|
$this->entity->fallStart = false;
|
||||||
|
$this->entity->setPosition($pos, $yaw, $pitch);
|
||||||
|
$this->entity->resetSpeed();
|
||||||
|
$this->entity->updateLast();
|
||||||
|
$this->entity->calculateVelocity();
|
||||||
if($terrain === true){
|
if($terrain === true){
|
||||||
$this->orderChunks();
|
$this->orderChunks();
|
||||||
$this->getNextChunk(false);
|
$this->getNextChunk(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user