Class BreakBlockEvent
java.lang.Object
fr.hytale.loader.event.types.ecs.BreakBlockEvent
- All Implemented Interfaces:
com.hypixel.hytale.event.IBaseEvent<Void>, com.hypixel.hytale.event.IEvent<Void>
Called when a block is broken.
This event is fired when any entity (including players) breaks a block in the world. It provides information about the block type, position, and the item used. The event can be cancelled to prevent the block from being broken.
- Since:
- 1.0.1
- Version:
- 1.0.4
- Author:
- HytaleLoader
-
Constructor Summary
ConstructorsConstructorDescriptionBreakBlockEvent(com.hypixel.hytale.server.core.event.events.ecs.BreakBlockEvent originalEvent, Player player) Constructs a new BreakBlockEvent. -
Method Summary
Modifier and TypeMethodDescriptioncom.hypixel.hytale.server.core.asset.type.blocktype.config.BlockTypeGets the type of block being broken.com.hypixel.hytale.server.core.inventory.ItemStackGets the item being used to break the block.Gets the player who broke the block.com.hypixel.hytale.math.vector.Vector3iGets the position of the block being broken.booleanChecks if this event has been cancelled.voidsetCancelled(boolean cancelled) Sets the cancelled state of this event.voidsetTargetBlock(com.hypixel.hytale.math.vector.Vector3i targetBlock) Sets the target block position.
-
Constructor Details
-
BreakBlockEvent
public BreakBlockEvent(com.hypixel.hytale.server.core.event.events.ecs.BreakBlockEvent originalEvent, Player player) Constructs a new BreakBlockEvent.- Parameters:
originalEvent- the original Hytale ECS eventplayer- the player who broke the block, or null if not a player
-
-
Method Details
-
getItemInHand
public com.hypixel.hytale.server.core.inventory.ItemStack getItemInHand()Gets the item being used to break the block.- Returns:
- the item in hand, or null if no item
-
getTargetBlock
public com.hypixel.hytale.math.vector.Vector3i getTargetBlock()Gets the position of the block being broken.- Returns:
- the block position
-
getBlockType
public com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType getBlockType()Gets the type of block being broken.- Returns:
- the block type
-
setTargetBlock
public void setTargetBlock(com.hypixel.hytale.math.vector.Vector3i targetBlock) Sets the target block position.- Parameters:
targetBlock- the new target position
-
isCancelled
public boolean isCancelled()Checks if this event has been cancelled.- Returns:
- true if cancelled, false otherwise
-
setCancelled
public void setCancelled(boolean cancelled) Sets the cancelled state of this event.- Parameters:
cancelled- true to cancel, false to allow
-
getPlayer
Gets the player who broke the block.- Returns:
- the player, or null if the block was not broken by a player
-