Class DropItemEvent

java.lang.Object
fr.hytale.loader.event.types.ecs.DropItemEvent
All Implemented Interfaces:
com.hypixel.hytale.event.IBaseEvent<Void>, com.hypixel.hytale.event.IEvent<Void>

public class DropItemEvent extends Object implements com.hypixel.hytale.event.IEvent<Void>
Called when an item is dropped.

This event is fired when a player drops an item from their inventory. It provides access to the item stack and throw speed. The event can be cancelled to prevent the item from being dropped.

Since:
1.0.1
Version:
1.0.4
Author:
HytaleLoader
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    com.hypixel.hytale.server.core.inventory.ItemStack
    Gets the item stack being dropped.
    Gets the player who dropped the item.
    float
    Gets the velocity at which the item will be thrown.
    boolean
    Checks if this event has been cancelled.
    void
    setCancelled(boolean cancelled)
    Sets the cancelled state of this event.
    void
    setItemStack(com.hypixel.hytale.server.core.inventory.ItemStack itemStack)
    Sets the item stack to be dropped.
    void
    setThrowSpeed(float throwSpeed)
    Sets the velocity at which the item will be thrown.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DropItemEvent

      public DropItemEvent(com.hypixel.hytale.server.core.event.events.ecs.DropItemEvent.Drop originalEvent, Player player)
      Constructs a new DropItemEvent.
      Parameters:
      originalEvent - the original Hytale ECS event
      player - the player who dropped the item, or null if not a player
  • Method Details

    • getItemStack

      public com.hypixel.hytale.server.core.inventory.ItemStack getItemStack()
      Gets the item stack being dropped.
      Returns:
      the item stack
    • setItemStack

      public void setItemStack(com.hypixel.hytale.server.core.inventory.ItemStack itemStack)
      Sets the item stack to be dropped.
      Parameters:
      itemStack - the new item stack
    • getThrowSpeed

      public float getThrowSpeed()
      Gets the velocity at which the item will be thrown.
      Returns:
      the throw speed
    • setThrowSpeed

      public void setThrowSpeed(float throwSpeed)
      Sets the velocity at which the item will be thrown.
      Parameters:
      throwSpeed - the new throw speed
    • 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 dropped the item.
      Returns:
      the player, or null if the item was not dropped by a player