mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 11:24:11 +01:00
SPIGOT-3917: Add EntityDropItemEvent
By: Articdive <articdive@gmail.com>
This commit is contained in:
parent
bd2074a93d
commit
cb8ec6543b
1 changed files with 49 additions and 0 deletions
|
@ -0,0 +1,49 @@
|
|||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Thrown when an entity creates an item drop.
|
||||
*/
|
||||
public class EntityDropItemEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Item drop;
|
||||
private boolean cancel = false;
|
||||
|
||||
public EntityDropItemEvent(final Entity entity, final Item drop) {
|
||||
super(entity);
|
||||
this.drop = drop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Item created by the entity
|
||||
*
|
||||
* @return Item created by the entity
|
||||
*/
|
||||
public Item getItemDrop() {
|
||||
return drop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue