Player: Dump crafting grid on death, not on respawn

This fixes players managing to retain items by getting killed while they have something in the crafting grid.
This commit is contained in:
Dylan K. Taylor 2017-12-22 11:31:31 +00:00
parent 8bf275cb8b
commit 2e11e448dd

View File

@ -2645,8 +2645,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
break;
}
$this->resetCraftingGridType();
$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $this->getSpawn()));
$realSpawn = Position::fromObject($ev->getRespawnPosition()->add(0.5, 0, 0.5), $ev->getRespawnPosition()->getLevel());
@ -3552,6 +3550,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
break;
}
//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->resetCraftingGridType();
$this->server->getPluginManager()->callEvent($ev = new PlayerDeathEvent($this, $this->getDrops(), new TranslationContainer($message, $params)));
if(!$ev->getKeepInventory()){