Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.event.player.PlayerItemConsumeEvent Class Reference
Inheritance diagram for org.bukkit.event.player.PlayerItemConsumeEvent:
org.bukkit.event.player.PlayerEvent org.bukkit.event.Cancellable org.bukkit.event.Event

Public Member Functions

 PlayerItemConsumeEvent (final Player player, final ItemStack item)
ItemStack getItem ()
void setItem (ItemStack item)
boolean isCancelled ()
void setCancelled (boolean cancel)
HandlerList getHandlers ()
- Public Member Functions inherited from org.bukkit.event.player.PlayerEvent
 PlayerEvent (final Player who)
final Player getPlayer ()
- Public Member Functions inherited from org.bukkit.event.Event
 Event ()
 Event (boolean isAsync)
String getEventName ()
abstract HandlerList getHandlers ()
final boolean isAsynchronous ()

Static Public Member Functions

static HandlerList getHandlerList ()

Additional Inherited Members

- Protected Attributes inherited from org.bukkit.event.player.PlayerEvent
Player player

Detailed Description

This event will fire when a player is finishing consuming an item (food, potion, milk bucket).
If the ItemStack is modified the server will use the effects of the new item and not remove the original one from the player's inventory.
If the event is cancelled the effect will not be applied and the item will not be removed from the player's inventory.

Definition at line 19 of file PlayerItemConsumeEvent.java.

Constructor & Destructor Documentation

org.bukkit.event.player.PlayerItemConsumeEvent.PlayerItemConsumeEvent ( final Player  player,
final ItemStack  item 
playerthe player consuming
itemthe ItemStack being consumed

Definition at line 28 of file PlayerItemConsumeEvent.java.

28  {
29  super(player);
31  this.item = item;
32  }

Member Function Documentation

ItemStack org.bukkit.event.player.PlayerItemConsumeEvent.getItem ( )

Gets the item that is being consumed. Modifying the returned item will have no effect, you must use setItem(org.bukkit.inventory.ItemStack) instead.

an ItemStack for the item being consumed

Definition at line 41 of file PlayerItemConsumeEvent.java.

41  {
42  return item.clone();
43  }
boolean org.bukkit.event.player.PlayerItemConsumeEvent.isCancelled ( )

Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

true if this event is cancelled

Implements org.bukkit.event.Cancellable.

Definition at line 58 of file PlayerItemConsumeEvent.java.

58  {
59  return this.isCancelled;
60  }
void org.bukkit.event.player.PlayerItemConsumeEvent.setCancelled ( boolean  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.

canceltrue if you wish to cancel this event

Implements org.bukkit.event.Cancellable.

Definition at line 62 of file PlayerItemConsumeEvent.java.

62  {
63  this.isCancelled = cancel;
64  }
void org.bukkit.event.player.PlayerItemConsumeEvent.setItem ( ItemStack  item)

Set the item being consumed

itemthe item being consumed

Definition at line 50 of file PlayerItemConsumeEvent.java.

50  {
51  if (item == null) {
52  this.item = new ItemStack(Material.AIR);
53  } else {
54  this.item = item;
55  }
56  }

The documentation for this class was generated from the following file: