Class PlayerStartDiggingEvent

java.lang.Object
net.minestom.server.event.player.PlayerStartDiggingEvent
All Implemented Interfaces:
Event, BlockEvent, CancellableEvent, EntityEvent, EntityInstanceEvent, InstanceEvent, PlayerEvent, PlayerInstanceEvent

public class PlayerStartDiggingEvent extends Object implements PlayerInstanceEvent, BlockEvent, CancellableEvent
Called when a Player start digging a block, can be used to forbid the Player from mining it.

Be aware that cancelling this event does not necessary prevent the player from breaking the block (could be because of high latency or a modified client) so cancelling PlayerBlockBreakEvent is also necessary. Could be fixed in future Minestom version.

  • Constructor Details

  • Method Details

    • getBlock

      public Block getBlock()
      Gets the block which is being dug.
      Specified by:
      getBlock in interface BlockEvent
      Returns:
      the block
    • getBlockPosition

      public BlockVec getBlockPosition()
      Gets the block position.
      Specified by:
      getBlockPosition in interface BlockEvent
      Returns:
      the block position
    • getBlockFace

      public BlockFace getBlockFace()
      Gets the face you are digging
      Returns:
      the block face
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: CancellableEvent
      Gets if the Event should be cancelled or not.
      Specified by:
      isCancelled in interface CancellableEvent
      Returns:
      true if the event should be cancelled
    • setCancelled

      public void setCancelled(boolean cancel)
      Description copied from interface: CancellableEvent
      Marks the Event as cancelled or not.
      Specified by:
      setCancelled in interface CancellableEvent
      Parameters:
      cancel - true if the event should be cancelled, false otherwise
    • getPlayer

      public Player getPlayer()
      Description copied from interface: PlayerEvent
      Gets the player.
      Specified by:
      getPlayer in interface PlayerEvent
      Returns:
      the player