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
ConstructorsConstructorDescriptionPlayerStartDiggingEvent(Player player, Block block, BlockVec blockPosition, BlockFace blockFace) -
Method Summary
Modifier and TypeMethodDescriptiongetBlock()Gets the block which is being dug.Gets the face you are diggingGets the block position.Gets the player.booleanGets if theEventshould be cancelled or not.voidsetCancelled(boolean cancel) Marks theEventas cancelled or not.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EntityInstanceEvent
getInstanceMethods inherited from interface PlayerEvent
getEntity
-
Constructor Details
-
PlayerStartDiggingEvent
-
-
Method Details
-
getBlock
Gets the block which is being dug.- Specified by:
getBlockin interfaceBlockEvent- Returns:
- the block
-
getBlockPosition
Gets the block position.- Specified by:
getBlockPositionin interfaceBlockEvent- Returns:
- the block position
-
getBlockFace
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableEventGets if theEventshould be cancelled or not.- Specified by:
isCancelledin interfaceCancellableEvent- Returns:
- true if the event should be cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:CancellableEventMarks theEventas cancelled or not.- Specified by:
setCancelledin interfaceCancellableEvent- Parameters:
cancel- true if the event should be cancelled, false otherwise
-
getPlayer
Description copied from interface:PlayerEventGets the player.- Specified by:
getPlayerin interfacePlayerEvent- Returns:
- the player
-