Class BlockBreakEvent

java.lang.Object
fr.fidorial.event.block.BlockBreakEvent
All Implemented Interfaces:
Cancellable, Event, PlayerEvent

public final class BlockBreakEvent extends Object implements PlayerEvent, Cancellable
Fired when a player breaks a block, before the block is removed from the world.

Cancelling the event keeps the block in place and resyncs the position to the client.

Since:
0.1.0
  • Constructor Details

    • BlockBreakEvent

      public BlockBreakEvent(Player player, BlockPos position)
      Creates an event.
      Parameters:
      player - the player breaking the block
      position - the position of the block, in the player's world
      Since:
      0.1.0
  • Method Details

    • player

      public Player player()
      Description copied from interface: PlayerEvent
      Returns the player involved in this event.
      Specified by:
      player in interface PlayerEvent
      Returns:
      the player involved in this event
    • world

      public World world()
      Returns the world the block belongs to, that is the world of the player.
      Returns:
      the world the block belongs to, that is the world of the player
      Since:
      0.1.0
    • position

      public BlockPos position()
      Returns the position of the block.
      Returns:
      the position of the block
      Since:
      0.1.0
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Returns true if the action this event describes will not happen.
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if the action this event describes will not happen
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: Cancellable
      Prevents or re-allows the action this event describes.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancelled - true to prevent it