Adding PLAYER_PICKUP_ITEM event
This commit is contained in:
parent
6c86db411c
commit
164b687bcd
@ -241,6 +241,13 @@ public abstract class Event {
|
|||||||
*/
|
*/
|
||||||
PLAYER_DROP_ITEM (Category.PLAYER),
|
PLAYER_DROP_ITEM (Category.PLAYER),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player picks an item up off the ground
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.player.PlayerPickupItemEvent
|
||||||
|
*/
|
||||||
|
PLAYER_PICKUP_ITEM (Category.PLAYER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BLOCK EVENTS
|
* BLOCK EVENTS
|
||||||
*/
|
*/
|
||||||
@ -445,7 +452,7 @@ public abstract class Event {
|
|||||||
* @todo: add javadoc see comment
|
* @todo: add javadoc see comment
|
||||||
*/
|
*/
|
||||||
ITEM_SPAWN (Category.WORLD),
|
ITEM_SPAWN (Category.WORLD),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a world is saved
|
* Called when a world is saved
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
|
||||||
|
package org.bukkit.event.player;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown when a player picks an item up from the ground
|
||||||
|
*/
|
||||||
|
public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
||||||
|
private final Item item;
|
||||||
|
private boolean cancel = false;
|
||||||
|
|
||||||
|
public PlayerPickupItemEvent(final Player player, final Item item) {
|
||||||
|
super(Event.Type.PLAYER_PICKUP_ITEM, player);
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the ItemDrop created by the player
|
||||||
|
*
|
||||||
|
* @return Item
|
||||||
|
*/
|
||||||
|
public Item getItem() {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the cancellation state of this event. A cancelled event will not
|
||||||
|
* be executed in the server, but will still pass to other plugins
|
||||||
|
*
|
||||||
|
* If an item pickup event is cancelled, the item will not be picked up.
|
||||||
|
* This will not fire an event.
|
||||||
|
*
|
||||||
|
* @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
|
||||||
|
*
|
||||||
|
* If an item pickup event is cancelled, the item will not be picked up.
|
||||||
|
* This will not fire an event.
|
||||||
|
*
|
||||||
|
* @param cancel true if you wish to cancel this event
|
||||||
|
*/
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user