Class PlayerBlockPlaceEvent
java.lang.Object
net.minestom.server.event.player.PlayerBlockPlaceEvent
- All Implemented Interfaces:
Event, BlockEvent, CancellableEvent, EntityEvent, EntityInstanceEvent, InstanceEvent, PlayerEvent, PlayerInstanceEvent
public class PlayerBlockPlaceEvent
extends Object
implements PlayerInstanceEvent, BlockEvent, CancellableEvent
Called when a player tries placing a block.
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerBlockPlaceEvent(Player player, Block block, BlockFace blockFace, BlockVec blockPosition, Point cursorPosition, PlayerHand hand) -
Method Summary
Modifier and TypeMethodDescriptionvoidconsumeBlock(boolean consumeBlock) Should the block be consumed if not cancelled.booleanShould the block be consumed if not cancelled.getBlock()Gets the block which will be placed.Gets the block position.getHand()Gets the hand with which the player is trying to place.Gets the player.booleanGets if theEventshould be cancelled or not.voidChanges the block to be placed.voidsetCancelled(boolean cancel) Marks theEventas cancelled or not.voidsetDoBlockUpdates(boolean doBlockUpdates) Should the place trigger updates (on self and neighbors)booleanShould the place trigger updates (on self and neighbors)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
-
PlayerBlockPlaceEvent
-
-
Method Details
-
getBlock
Gets the block which will be placed.- Specified by:
getBlockin interfaceBlockEvent- Returns:
- the block to place
-
setBlock
-
getBlockFace
-
getBlockPosition
Gets the block position.- Specified by:
getBlockPositionin interfaceBlockEvent- Returns:
- the block position
-
getCursorPosition
-
getHand
Gets the hand with which the player is trying to place.- Returns:
- the hand used
-
consumeBlock
public void consumeBlock(boolean consumeBlock) Should the block be consumed if not cancelled.- Parameters:
consumeBlock- true if the block should be consumer (-1 amount), false otherwise
-
doesConsumeBlock
public boolean doesConsumeBlock()Should the block be consumed if not cancelled.- Returns:
- true if the block will be consumed, false otherwise
-
setDoBlockUpdates
public void setDoBlockUpdates(boolean doBlockUpdates) Should the place trigger updates (on self and neighbors)- Parameters:
doBlockUpdates- true if this placement should do block updates
-
shouldDoBlockUpdates
public boolean shouldDoBlockUpdates()Should the place trigger updates (on self and neighbors)- Returns:
- true if this placement should do block updates
-
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
-