Class PlaceBlockEvent
java.lang.Object
fr.hytale.loader.event.types.ecs.PlaceBlockEvent
- All Implemented Interfaces:
com.hypixel.hytale.event.IBaseEvent<Void>, com.hypixel.hytale.event.IEvent<Void>
Called when a block is placed.
This event is fired when any entity (including players) places a block in the world. It provides information about the position, rotation, and the item used. The event can be cancelled to prevent the block from being placed.
- Since:
- 1.0.1
- Version:
- 1.0.4
- Author:
- HytaleLoader
-
Constructor Summary
ConstructorsConstructorDescriptionPlaceBlockEvent(com.hypixel.hytale.server.core.event.events.ecs.PlaceBlockEvent originalEvent, Player player) Constructs a new PlaceBlockEvent. -
Method Summary
Modifier and TypeMethodDescriptioncom.hypixel.hytale.server.core.inventory.ItemStackGets the item being used to place the block.Gets the player who placed the block.com.hypixel.hytale.server.core.asset.type.blocktype.config.RotationTupleGets the rotation of the block being placed.com.hypixel.hytale.math.vector.Vector3iGets the position where the block is being placed.booleanChecks if this event has been cancelled.voidsetCancelled(boolean cancelled) Sets the cancelled state of this event.voidsetRotation(com.hypixel.hytale.server.core.asset.type.blocktype.config.RotationTuple rotation) Sets the rotation of the block.voidsetTargetBlock(com.hypixel.hytale.math.vector.Vector3i targetBlock) Sets the target block position.
-
Constructor Details
-
PlaceBlockEvent
public PlaceBlockEvent(com.hypixel.hytale.server.core.event.events.ecs.PlaceBlockEvent originalEvent, Player player) Constructs a new PlaceBlockEvent.- Parameters:
originalEvent- the original Hytale ECS eventplayer- the player who placed the block, or null if not a player
-
-
Method Details
-
getItemInHand
public com.hypixel.hytale.server.core.inventory.ItemStack getItemInHand()Gets the item being used to place the block.- Returns:
- the item in hand, or null if no item
-
getTargetBlock
public com.hypixel.hytale.math.vector.Vector3i getTargetBlock()Gets the position where the block is being placed.- Returns:
- the block position
-
setTargetBlock
public void setTargetBlock(com.hypixel.hytale.math.vector.Vector3i targetBlock) Sets the target block position.- Parameters:
targetBlock- the new target position
-
getRotation
public com.hypixel.hytale.server.core.asset.type.blocktype.config.RotationTuple getRotation()Gets the rotation of the block being placed.- Returns:
- the block rotation
-
setRotation
public void setRotation(com.hypixel.hytale.server.core.asset.type.blocktype.config.RotationTuple rotation) Sets the rotation of the block.- Parameters:
rotation- the new rotation
-
isCancelled
public boolean isCancelled()Checks if this event has been cancelled.- Returns:
- true if cancelled, false otherwise
-
setCancelled
public void setCancelled(boolean cancelled) Sets the cancelled state of this event.- Parameters:
cancelled- true to cancel, false to allow
-
getPlayer
Gets the player who placed the block.- Returns:
- the player, or null if the block was not placed by a player
-