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>

public class BreakBlockEvent extends Object implements 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

    Constructors
    Constructor
    Description
    BreakBlockEvent(com.hypixel.hytale.server.core.event.events.ecs.BreakBlockEvent originalEvent, Player player)
    Constructs a new BreakBlockEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType
    Gets the type of block being broken.
    com.hypixel.hytale.server.core.inventory.ItemStack
    Gets the item being used to break the block.
    Gets the player who broke the block.
    com.hypixel.hytale.math.vector.Vector3i
    Gets the position of the block being broken.
    boolean
    Checks if this event has been cancelled.
    void
    setCancelled(boolean cancelled)
    Sets the cancelled state of this event.
    void
    setTargetBlock(com.hypixel.hytale.math.vector.Vector3i targetBlock)
    Sets the target block position.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 event
      player - 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

      public Player getPlayer()
      Gets the player who broke the block.
      Returns:
      the player, or null if the block was not broken by a player