Package net.minestom.server.event.player
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 Summary
Constructors Constructor Description PlayerBlockBreakEvent(Player player, BlockPosition blockPosition, short blockStateId, CustomBlock customBlock, short resultBlockStateId, short resultCustomBlockId)
-
Method Summary
Modifier and Type Method Description BlockPosition
getBlockPosition()
Gets the block position.short
getBlockStateId()
Gets the broken block state id.CustomBlock
getCustomBlock()
Gets the broken custom block.Player
getPlayer()
Gets the player who breaks the block.short
getResultBlockStateId()
Gets the visual block id result, which will be placed after the event.short
getResultCustomBlockId()
Gets the custom block id result, which will be placed after the event.void
setResultBlockId(short resultBlockStateId)
Changes the visual block id result.void
setResultCustomBlockId(short resultCustomBlockId)
Changes the custom block id result, which will be placed after the event;
-
Constructor Details
-
PlayerBlockBreakEvent
public PlayerBlockBreakEvent(@NotNull Player player, @NotNull BlockPosition blockPosition, short blockStateId, @Nullable CustomBlock customBlock, short resultBlockStateId, short resultCustomBlockId)
-
-
Method Details
-
getPlayer
Gets the player who breaks the block.- Returns:
- the player
-
getBlockPosition
Gets the block position.- Returns:
- the block position
-
getBlockStateId
public short getBlockStateId()Gets the broken block state id.- Returns:
- the block id
-
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 asCustomBlock.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
-