PlayerDeathEvent: fixed constructor signature, closes #2835

can we ban multi-type parameters already? this is tiresome...
This commit is contained in:
Dylan K. Taylor 2019-03-25 14:55:25 +00:00
parent 999174b0a7
commit ca22223b62
2 changed files with 4 additions and 3 deletions

View File

@ -2808,7 +2808,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
//main inventory and drops the rest on the ground.
$this->doCloseInventory();
$ev = new PlayerDeathEvent($this, $this->getDrops(), $this->getXpDropAmount());
$ev = new PlayerDeathEvent($this, $this->getDrops(), $this->getXpDropAmount(), null);
$ev->call();
if(!$ev->getKeepInventory()){

View File

@ -45,10 +45,11 @@ class PlayerDeathEvent extends EntityDeathEvent{
/**
* @param Player $entity
* @param Item[] $drops
* @param int $xp
* @param string|TextContainer|null $deathMessage Null will cause the default vanilla message to be used
*/
public function __construct(Player $entity, array $drops, $deathMessage = null){
parent::__construct($entity, $drops);
public function __construct(Player $entity, array $drops, int $xp, $deathMessage){
parent::__construct($entity, $drops, $xp);
$this->deathMessage = $deathMessage ?? self::deriveMessage($entity->getDisplayName(), $entity->getLastDamageCause());
}