BlockEvent base class.
BlockEvent Base Class
All block events inherit from this class:Returns the block involved in the event
Player Block Interaction
BlockBreakEvent
BlockBreakEvent
Cancellable: YesCalled when a player breaks a block.Methods:
getPlayer()- Returns the player breaking the blockgetItem()- Returns the item used to break the blockgetInstaBreak()- Returns whether block breaks instantly (e.g., creative mode)setInstaBreak(bool $instaBreak)- Sets instant breakgetDrops()- Returns array of items that will dropsetDrops(array $drops)- Sets the items that will dropgetXpDropAmount()- Returns XP that will dropsetXpDropAmount(int $amount)- Sets XP that will drop
BlockPlaceEvent
BlockPlaceEvent
Cancellable: YesCalled when a player places one or more blocks.Methods:
getPlayer()- Returns the player placing the blockgetItem()- Returns the item in handgetTransaction()- Returns BlockTransaction with all blocks being placedgetBlockAgainst()- Returns the block that was clicked to place
Natural Block Changes
BlockGrowEvent
BlockGrowEvent
Cancellable: YesCalled when a block grows naturally (crops, saplings, etc.).Methods:
getNewState()- Returns the block state after growth
BlockSpreadEvent
BlockSpreadEvent
Cancellable: YesCalled when a block spreads (fire, vines, etc.).Methods:
getSource()- Returns the source block causing the spreadgetNewState()- Returns the new block state
BlockFormEvent
BlockFormEvent
Cancellable: YesCalled when a block forms (ice, snow, concrete, etc.).Methods:
getNewState()- Returns the new block state
BlockMeltEvent
BlockMeltEvent
Cancellable: YesCalled when a block melts (ice to water, snow melting).Methods:
getNewState()- Returns the new block state after melting
BlockBurnEvent
BlockBurnEvent
Cancellable: YesCalled when a block is burned away by fire.Methods:
getCausingBlock()- Returns the block (usually Fire) causing the burn
LeavesDecayEvent
LeavesDecayEvent
Cancellable: YesCalled when leaves decay naturally.
Block State Changes
BlockUpdateEvent
BlockUpdateEvent
Cancellable: YesCalled when a block receives a block update (neighbor change).
SignChangeEvent
SignChangeEvent
Cancellable: YesCalled when a player changes text on a sign.Methods:
getPlayer()- Returns the player editing the signgetOldText()- Returns the old SignTextgetNewText()- Returns the new SignTextsetNewText(SignText $text)- Sets the new sign text
FarmlandHydrationChangeEvent
FarmlandHydrationChangeEvent
Cancellable: YesCalled when farmland hydration level changes.Methods:
getOldHydration()- Returns old hydration levelgetNewHydration()- Returns new hydration levelsetNewHydration(int $hydration)- Sets new hydration level
PressurePlateUpdateEvent
PressurePlateUpdateEvent
Cancellable: YesCalled when a pressure plate activates or deactivates.Methods:
getActivatedEntities()- Returns entities on the platehasActivatedEntities()- Returns whether plate is activated
Explosions
BlockExplodeEvent
BlockExplodeEvent
Cancellable: YesCalled when a block explodes (TNT, etc.).Methods:
getBlockList()- Returns array of Position objects that will be destroyedsetBlockList(array $blocks)- Sets the blocks to destroygetYieldDrops()- Returns whether blocks drop itemssetYieldDrops(bool $yield)- Sets whether blocks drop items
BlockPreExplodeEvent
BlockPreExplodeEvent
Cancellable: YesCalled before an explosion affects blocks, allows modification of which blocks will be destroyed.Methods:
getAffectedBlocks()- Returns blocks that will be affectedsetAffectedBlocks(array $blocks)- Sets blocks to be affected
Structure Events
StructureGrowEvent
StructureGrowEvent
Cancellable: YesCalled when a structure grows (tree, huge mushroom).Methods:
getPlayer()- Returns player who caused growth (or null)getTransaction()- Returns BlockTransaction with all blocks
ChestPairEvent
ChestPairEvent
Cancellable: YesCalled when two chests pair to form a double chest.Methods:
getOtherChest()- Returns the other chest block
Tile Entity Events
BrewItemEvent
BrewItemEvent
Cancellable: YesCalled when brewing completes in a brewing stand.Methods:
getIngredient()- Returns the ingredient usedgetResults()- Returns array of resulting itemssetResults(array $results)- Sets the brewing results
BrewingFuelUseEvent
BrewingFuelUseEvent
Cancellable: YesCalled when brewing stand consumes fuel.Methods:
getFuel()- Returns the fuel itemgetFuelTime()- Returns fuel duration in tickssetFuelTime(int $time)- Sets fuel duration
CampfireCookEvent
CampfireCookEvent
Cancellable: YesCalled when food finishes cooking on a campfire.Methods:
getRawItem()- Returns the raw food itemgetResult()- Returns the cooked resultsetResult(Item $item)- Sets the cooked result
Special Block Events
BlockTeleportEvent
BlockTeleportEvent
Cancellable: YesCalled when a block teleports (dragon egg, shulker box).Methods:
getFrom()- Returns original positiongetTo()- Returns destination positionsetTo(Position $to)- Sets destination position
BlockItemPickupEvent
BlockItemPickupEvent
Cancellable: YesCalled when a block (like hopper) picks up an item.Methods:
getOrigin()- Returns the picking blockgetItem()- Returns the item entity being picked upgetInventory()- Returns the inventory receiving the item
BlockDeathEvent
BlockDeathEvent
Cancellable: NoCalled when a block is removed from the world.Methods:
getNewState()- Returns the replacement blockgetDrops()- Returns items that will dropsetDrops(array $drops)- Sets items to dropgetXpDropAmount()- Returns XP to dropsetXpDropAmount(int $amount)- Sets XP to drop
Complete Block Event List
All block events:BaseBlockChangeEvent- Base class for block changesBlockBreakEvent- Player breaks blockBlockBurnEvent- Block burnsBlockDeathEvent- Block is removedBlockExplodeEvent- Block explosionBlockFormEvent- Block formsBlockGrowEvent- Block growsBlockItemPickupEvent- Block picks up itemBlockMeltEvent- Block meltsBlockPlaceEvent- Player places blockBlockPreExplodeEvent- Before explosionBlockSpreadEvent- Block spreadsBlockTeleportEvent- Block teleportsBlockUpdateEvent- Block updateBrewItemEvent- Brewing completesBrewingFuelUseEvent- Brewing fuel consumedCampfireCookEvent- Campfire cooking completesChestPairEvent- Chests pairFarmlandHydrationChangeEvent- Farmland hydration changesLeavesDecayEvent- Leaves decayPressurePlateUpdateEvent- Pressure plate state changesSignChangeEvent- Sign text changesStructureGrowEvent- Structure grows