Class PlayerBlockBreakEvent

java.lang.Object
net.minestom.server.event.Event
net.minestom.server.event.CancellableEvent
net.minestom.server.event.player.PlayerBlockBreakEvent

public class PlayerBlockBreakEvent
extends CancellableEvent
  • Constructor Details

  • Method Details

    • getPlayer

      @NotNull public Player getPlayer()
      Gets the player who breaks the block.
      Returns:
      the player
    • getBlockPosition

      @NotNull public BlockPosition getBlockPosition()
      Gets the block position.
      Returns:
      the block position
    • getBlockStateId

      public short getBlockStateId()
      Gets the broken block state id.
      Returns:
      the block id
    • getCustomBlock

      @Nullable public CustomBlock getCustomBlock()
      Gets the broken custom block.
      Returns:
      the custom block, null if not any
    • getResultBlockStateId

      public short getResultBlockStateId()
      Gets the visual block id result, which will be placed after the event.
      Returns:
      the block id that will be set at getBlockPosition() set to 0 to remove
    • setResultBlockId

      public void setResultBlockId​(short resultBlockStateId)
      Changes the visual block id result.
      Parameters:
      resultBlockStateId - the result block id
    • getResultCustomBlockId

      public short getResultCustomBlockId()
      Gets the custom block id result, which will be placed after the event.

      Warning: the visual block will not be changed, be sure to call setResultBlockId(short) if you want the visual to be the same as CustomBlock.getDefaultBlockStateId().

      Returns:
      the custom block id that will be set at getBlockPosition() set to 0 to remove
    • setResultCustomBlockId

      public void setResultCustomBlockId​(short resultCustomBlockId)
      Changes the custom block id result, which will be placed after the event;
      Parameters:
      resultCustomBlockId - the custom block id result