Package net.minestom.server.event.player
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 Summary
ConstructorDescriptionPlayerStartDiggingEvent
(@NotNull Player player, @NotNull Block block, @NotNull BlockVec blockPosition, @NotNull BlockFace blockFace) -
Method Summary
Modifier and TypeMethodDescription@NotNull Block
getBlock()
Gets the block which is being dug.@NotNull BlockFace
Gets the face you are digging@NotNull BlockVec
Gets the block position.@NotNull Player
Gets the player.boolean
Gets if theEvent
should be cancelled or not.void
setCancelled
(boolean cancel) Marks theEvent
as cancelled or not.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minestom.server.event.trait.EntityInstanceEvent
getInstance
Methods inherited from interface net.minestom.server.event.trait.PlayerEvent
getEntity
-
Constructor Details
-
PlayerStartDiggingEvent
-
-
Method Details
-
getBlock
Gets the block which is being dug.- Specified by:
getBlock
in interfaceBlockEvent
- Returns:
- the block
-
getBlockPosition
Gets the block position.- Specified by:
getBlockPosition
in interfaceBlockEvent
- Returns:
- the block position
-
getBlockFace
Gets the face you are digging- Returns:
- the block face
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableEvent
Gets if theEvent
should be cancelled or not.- Specified by:
isCancelled
in interfaceCancellableEvent
- Returns:
- true if the event should be cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:CancellableEvent
Marks theEvent
as cancelled or not.- Specified by:
setCancelled
in interfaceCancellableEvent
- Parameters:
cancel
- true if the event should be cancelled, false otherwise
-
getPlayer
Description copied from interface:PlayerEvent
Gets the player.- Specified by:
getPlayer
in interfacePlayerEvent
- Returns:
- the player
-