mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 03:08:58 +00:00
Workaround for bad calls to teleport, closes #3074
This commit is contained in:
parent
1e2038fac5
commit
eaa42f8449
@ -907,6 +907,10 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
* @return boolean
|
||||
*/
|
||||
public function sleepOn(Vector3 $pos){
|
||||
if(!$this->isOnline()){
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach($this->level->getNearbyEntities($this->boundingBox->grow(2, 1, 2), $this) as $p){
|
||||
if($p instanceof Player){
|
||||
if($p->sleeping !== null and $pos->distance($p->sleeping) <= 0.1){
|
||||
@ -2040,7 +2044,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
$this->stopSleep();
|
||||
break;
|
||||
case 7: //Respawn
|
||||
if($this->spawned === false or $this->isAlive()){
|
||||
if($this->spawned === false or $this->isAlive() or !$this->isOnline()){
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3069,6 +3073,10 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
}
|
||||
|
||||
public function teleport(Vector3 $pos, $yaw = null, $pitch = null){
|
||||
if(!$this->isOnline()){
|
||||
return;
|
||||
}
|
||||
|
||||
$oldPos = $this->getPosition();
|
||||
if(parent::teleport($pos, $yaw, $pitch)){
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user