Skip to content

BlockBreakEvent ​

class · pocketmine\event\block\BlockBreakEvent · source

Extends BlockEvent
Implements Cancellable

Called when a player destroys a block somewhere in the world.

Properties ​

$blockDrops protected ​

php
protected array $blockDrops

$instaBreak ​

php
public bool $instaBreak

$item ​

php
public \pocketmine\item\Item $item

$player ​

php
public \pocketmine\player\Player $player

$xpDrops ​

php
public int $xpDrops

Methods ​

__construct() ​

php
public function __construct(\pocketmine\player\Player $player, \pocketmine\block\Block $block, \pocketmine\item\Item $item, bool $instaBreak = false, array $drops = [], int $xpDrops = 0)

getDrops() ​

php
public function getDrops() : array

getInstaBreak() ​

php
public function getInstaBreak() : bool

Returns whether the block may be broken in less than the amount of time calculated. This is usually true for creative players.

getItem() ​

php
public function getItem() : \pocketmine\item\Item

Returns the item used to destroy the block.

getPlayer() ​

php
public function getPlayer() : \pocketmine\player\Player

Returns the player who is destroying the block.

getXpDropAmount() ​

php
public function getXpDropAmount() : int

Returns how much XP will be dropped by breaking this block.

setDrops() ​

php
public function setDrops(array $drops) : void

setDropsVariadic() ​

php
public function setDropsVariadic(\pocketmine\item\Item ...$drops) : void

Variadic hack for easy array member type enforcement.

setInstaBreak() ​

php
public function setInstaBreak(bool $instaBreak) : void

setXpDropAmount() ​

php
public function setXpDropAmount(int $amount) : void

Sets how much XP will be dropped by breaking this block.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.