49 lines
1.2 KiB
Java
49 lines
1.2 KiB
Java
|
|
package org.bukkit.event.player;
|
|
|
|
import org.bukkit.entity.ItemDrop;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.event.Cancellable;
|
|
|
|
/**
|
|
* Thrown when a player drops an item from their inventory
|
|
*/
|
|
public class PlayerDropItemEvent extends PlayerEvent implements Cancellable {
|
|
private final ItemDrop drop;
|
|
private boolean cancel = false;
|
|
|
|
public PlayerDropItemEvent(final Type type, final Player player, final ItemDrop drop) {
|
|
super(type, player);
|
|
this.drop = drop;
|
|
}
|
|
|
|
/**
|
|
* Gets the ItemDrop created by the player
|
|
*
|
|
* @return ItemDrop
|
|
*/
|
|
public ItemDrop getItemDrop() {
|
|
return drop;
|
|
}
|
|
|
|
/**
|
|
* Gets the cancellation state of this event. A cancelled event will not
|
|
* be executed in the server, but will still pass to other plugins
|
|
*
|
|
* @return true if this event is cancelled
|
|
*/
|
|
public boolean isCancelled() {
|
|
return cancel;
|
|
}
|
|
|
|
/**
|
|
* Sets the cancellation state of this event. A cancelled event will not
|
|
* be executed in the server, but will still pass to other plugins
|
|
*
|
|
* @param cancel true if you wish to cancel this event
|
|
*/
|
|
public void setCancelled(boolean cancel) {
|
|
this.cancel = cancel;
|
|
}
|
|
}
|