setDrops($drops); } /** * Returns the player who is destroying the block. */ public function getPlayer() : Player{ return $this->player; } /** * Returns the item used to destroy the block. */ public function getItem() : Item{ return clone $this->item; } /** * Returns whether the block may be broken in less than the amount of time calculated. This is usually true for * creative players. */ public function getInstaBreak() : bool{ return $this->instaBreak; } public function setInstaBreak(bool $instaBreak) : void{ $this->instaBreak = $instaBreak; } /** * @return Item[] */ public function getDrops() : array{ return $this->blockDrops; } /** * @param Item[] $drops */ public function setDrops(array $drops) : void{ $this->setDropsVariadic(...$drops); } /** * Variadic hack for easy array member type enforcement. */ public function setDropsVariadic(Item ...$drops) : void{ $this->blockDrops = $drops; } /** * Returns how much XP will be dropped by breaking this block. */ public function getXpDropAmount() : int{ return $this->xpDrops; } /** * Sets how much XP will be dropped by breaking this block. */ public function setXpDropAmount(int $amount) : void{ if($amount < 0){ throw new \InvalidArgumentException("Amount must be at least zero"); } $this->xpDrops = $amount; } }