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>
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
ConstructorsConstructorDescriptionDropItemEvent(com.hypixel.hytale.server.core.event.events.ecs.DropItemEvent.Drop originalEvent, Player player) Constructs a new DropItemEvent. -
Method Summary
Modifier and TypeMethodDescriptioncom.hypixel.hytale.server.core.inventory.ItemStackGets the item stack being dropped.Gets the player who dropped the item.floatGets the velocity at which the item will be thrown.booleanChecks if this event has been cancelled.voidsetCancelled(boolean cancelled) Sets the cancelled state of this event.voidsetItemStack(com.hypixel.hytale.server.core.inventory.ItemStack itemStack) Sets the item stack to be dropped.voidsetThrowSpeed(float throwSpeed) Sets the velocity at which the item will be thrown.
-
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 eventplayer- 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
Gets the player who dropped the item.- Returns:
- the player, or null if the item was not dropped by a player
-