Entity: defer kill() until post-construct

this fixes crashes and various bugs with death logic executing during the creation of entities, as well as an age-old Player crash after quitting the server when dying.
This commit is contained in:
Dylan K. Taylor
2020-06-27 23:28:03 +01:00
parent 2a9586f6fd
commit 2104b2d32b
2 changed files with 7 additions and 5 deletions

View File

@ -2105,9 +2105,6 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
}
protected function onDeath() : void{
if(!$this->spawned){ //TODO: drop this hack
return;
}
//Crafting grid must always be evacuated even if keep-inventory is true. This dumps the contents into the
//main inventory and drops the rest on the ground.
$this->doCloseInventory();