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>

public class UseBlockEvent extends Object implements 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

    Constructors
    Constructor
    Description
    UseBlockEvent(com.hypixel.hytale.server.core.event.events.ecs.UseBlockEvent.Pre originalEvent, Player player)
    Constructs a new UseBlockEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType
    Gets the type of block being used.
    com.hypixel.hytale.server.core.entity.InteractionContext
    Gets the interaction context.
    com.hypixel.hytale.protocol.InteractionType
    Gets the type of interaction being performed.
    Gets the player who used the block.
    com.hypixel.hytale.math.vector.Vector3i
    Gets the position of the block being used.
    boolean
    Checks if this event has been cancelled.
    void
    setCancelled(boolean cancelled)
    Sets the cancelled state of this event.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 event
      player - 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

      public Player getPlayer()
      Gets the player who used the block.
      Returns:
      the player, or null if the block was not used by a player