Merge commit 141fbde6604da5001b73db0dae86fc6f397939e0

This commit is contained in:
Dylan K. Taylor 2021-11-01 17:39:40 +00:00
commit 804fb3f603
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -759,7 +759,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
if($this->getHealth() <= 0){
$this->logger->debug("Quit while dead, forcing respawn");
$this->respawn();
$this->actuallyRespawn();
}
}
@ -2100,10 +2100,6 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
}
public function respawn() : void{
if($this->respawnLocked){
return;
}
$this->respawnLocked = true;
if($this->server->isHardcore()){
if($this->kick("You have been banned because you died in hardcore mode")){ //this allows plugins to prevent the ban by cancelling PlayerKickEvent
$this->server->getNameBans()->addBan($this->getName(), "Died in hardcore mode");
@ -2111,6 +2107,15 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
return;
}
$this->actuallyRespawn();
}
protected function actuallyRespawn() : void{
if($this->respawnLocked){
return;
}
$this->respawnLocked = true;
$this->logger->debug("Waiting for spawn terrain generation for respawn");
$spawn = $this->getSpawn();
$spawn->getWorld()->orderChunkPopulation($spawn->getFloorX() >> Chunk::COORD_BIT_SIZE, $spawn->getFloorZ() >> Chunk::COORD_BIT_SIZE, null)->onCompletion(