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
ConstructorsConstructorDescriptionPlayerStartDiggingEvent(@NotNull Player player, @NotNull Block block, @NotNull BlockVec blockPosition, @NotNull BlockFace blockFace) -
Method Summary
Modifier and TypeMethodDescription@NotNull BlockgetBlock()Gets the block which is being dug.@NotNull BlockFaceGets the face you are digging@NotNull BlockVecGets the block position.@NotNull PlayerGets the player.booleanGets if theEventshould be cancelled or not.voidsetCancelled(boolean cancel) Marks theEventas cancelled or not.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minestom.server.event.trait.EntityInstanceEvent
getInstanceMethods 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:
getBlockin interfaceBlockEvent- Returns:
- the block
-
getBlockPosition
Gets the block position.- Specified by:
getBlockPositionin interfaceBlockEvent- Returns:
- the block position
-
getBlockFace
Gets the face you are digging- Returns:
- the block face
-
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
-