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>

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

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

    Modifier and Type
    Method
    Description
    com.hypixel.hytale.server.core.inventory.ItemStack
    Gets the item being used to place the block.
    Gets the player who placed the block.
    com.hypixel.hytale.server.core.asset.type.blocktype.config.RotationTuple
    Gets the rotation of the block being placed.
    com.hypixel.hytale.math.vector.Vector3i
    Gets the position where the block is being placed.
    boolean
    Checks if this event has been cancelled.
    void
    setCancelled(boolean cancelled)
    Sets the cancelled state of this event.
    void
    setRotation(com.hypixel.hytale.server.core.asset.type.blocktype.config.RotationTuple rotation)
    Sets the rotation of the block.
    void
    setTargetBlock(com.hypixel.hytale.math.vector.Vector3i targetBlock)
    Sets the target block position.

    Methods inherited from class Object

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

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