Class BlockPlaceEvent
java.lang.Object
fr.fidorial.event.block.BlockPlaceEvent
- All Implemented Interfaces:
Cancellable, Event, PlayerEvent
Fired when a player places a block, before the block is written to the world.
Cancelling the event leaves the world untouched and resyncs the position to the client.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionBlockPlaceEvent(Player player, BlockPos position, int stateId) Creates an event. -
Method Summary
Modifier and TypeMethodDescriptionResolves the block state about to be placed.booleanReturnstrueif the action this event describes will not happen.player()Returns the player involved in this event.position()Returns the position of the block.voidsetCancelled(boolean cancelled) Prevents or re-allows the action this event describes.intstateId()Returns the network identifier of the block state about to be placed.world()Returns the world the block belongs to, that is the world of the player.
-
Constructor Details
-
BlockPlaceEvent
-
-
Method Details
-
player
Description copied from interface:PlayerEventReturns the player involved in this event.- Specified by:
playerin interfacePlayerEvent- Returns:
- the player involved in this event
-
world
Returns the world the block belongs to, that is the world of the player.- Returns:
- the world the block belongs to, that is the world of the player
- Since:
- 0.1.0
-
position
Returns the position of the block.- Returns:
- the position of the block
- Since:
- 0.1.0
-
stateId
public int stateId()Returns the network identifier of the block state about to be placed.- Returns:
- the network identifier of the block state about to be placed
- Since:
- 0.1.0
- See Also:
-
blockData
Resolves the block state about to be placed.- Returns:
- the block state, or
nullifstateId()is unknown to the block registry - Since:
- 0.1.0
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableReturnstrueif the action this event describes will not happen.- Specified by:
isCancelledin interfaceCancellable- Returns:
trueif the action this event describes will not happen
-
setCancelled
public void setCancelled(boolean cancelled) Description copied from interface:CancellablePrevents or re-allows the action this event describes.- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancelled-trueto prevent it
-