Class UseBlockEvent
java.lang.Object
fr.hytale.loader.event.types.ecs.UseBlockEvent
- All Implemented Interfaces:
com.hypixel.hytale.event.IBaseEvent<Void>, com.hypixel.hytale.event.IEvent<Void>
Called when a block is used/interacted with.
This event is fired when a player right-clicks or otherwise interacts with a block. This can include opening doors, chests, or using interactive blocks. The event can be cancelled to prevent the interaction.
- Since:
- 1.0.1
- Version:
- 1.0.4
- Author:
- HytaleLoader
-
Constructor Summary
ConstructorsConstructorDescriptionUseBlockEvent(com.hypixel.hytale.server.core.event.events.ecs.UseBlockEvent.Pre originalEvent, Player player) Constructs a new UseBlockEvent. -
Method Summary
Modifier and TypeMethodDescriptioncom.hypixel.hytale.server.core.asset.type.blocktype.config.BlockTypeGets the type of block being used.com.hypixel.hytale.server.core.entity.InteractionContextGets the interaction context.com.hypixel.hytale.protocol.InteractionTypeGets the type of interaction being performed.Gets the player who used the block.com.hypixel.hytale.math.vector.Vector3iGets the position of the block being used.booleanChecks if this event has been cancelled.voidsetCancelled(boolean cancelled) Sets the cancelled state of this event.
-
Constructor Details
-
UseBlockEvent
public UseBlockEvent(com.hypixel.hytale.server.core.event.events.ecs.UseBlockEvent.Pre originalEvent, Player player) Constructs a new UseBlockEvent.- Parameters:
originalEvent- the original Hytale ECS eventplayer- the player who used the block, or null if not a player
-
-
Method Details
-
getInteractionType
public com.hypixel.hytale.protocol.InteractionType getInteractionType()Gets the type of interaction being performed.- Returns:
- the interaction type
-
getContext
public com.hypixel.hytale.server.core.entity.InteractionContext getContext()Gets the interaction context.- Returns:
- the interaction context
-
getTargetBlock
public com.hypixel.hytale.math.vector.Vector3i getTargetBlock()Gets the position of the block being used.- Returns:
- the block position
-
getBlockType
public com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType getBlockType()Gets the type of block being used.- Returns:
- the block type
-
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 used the block.- Returns:
- the player, or null if the block was not used by a player
-