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

Public Member Functions

 InventoryMoveItemEvent (final Inventory sourceInventory, final ItemStack itemStack, final Inventory destinationInventory, final boolean didSourceInitiate)
 
Inventory getSource ()
 
ItemStack getItem ()
 
void setItem (ItemStack itemStack)
 
Inventory getDestination ()
 
Inventory getInitiator ()
 
boolean isCancelled ()
 
void setCancelled (boolean cancel)
 
HandlerList getHandlers ()
 
- 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 ()
 

Detailed Description

Called when some entity or block (e.g. hopper) tries to move items directly from one inventory to another.

When this event is called, the initiator may already have removed the item from the source inventory and is ready to move it into the destination inventory.

If this event is cancelled, the items will be returned to the source inventory, if needed.

If this event is not cancelled, the initiator will try to put the ItemStack into the destination inventory. If this is not possible and the ItemStack has not been modified, the source inventory slot will be restored to its former state. Otherwise any additional items will be discarded.

Definition at line 26 of file InventoryMoveItemEvent.java.

Member Function Documentation

Inventory org.bukkit.event.inventory.InventoryMoveItemEvent.getDestination ( )

Gets the Inventory that the ItemStack is being put into

Returns
Inventory that the ItemStack is being put into

Definition at line 78 of file InventoryMoveItemEvent.java.

78  {
79  return destinationInventory;
80  }
Inventory org.bukkit.event.inventory.InventoryMoveItemEvent.getInitiator ( )

Gets the Inventory that initiated the transfer. This will always be either the destination or source Inventory.

Returns
Inventory that initiated the transfer

Definition at line 88 of file InventoryMoveItemEvent.java.

88  {
89  return didSourceInitiate ? sourceInventory : destinationInventory;
90  }
ItemStack org.bukkit.event.inventory.InventoryMoveItemEvent.getItem ( )

Gets the ItemStack being moved; if modified, the original item will not be removed from the source inventory.

Returns
ItemStack

Definition at line 57 of file InventoryMoveItemEvent.java.

57  {
58  return itemStack.clone();
59  }
Inventory org.bukkit.event.inventory.InventoryMoveItemEvent.getSource ( )

Gets the Inventory that the ItemStack is being taken from

Returns
Inventory that the ItemStack is being taken from

Definition at line 47 of file InventoryMoveItemEvent.java.

47  {
48  return sourceInventory;
49  }
boolean org.bukkit.event.inventory.InventoryMoveItemEvent.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

Returns
true if this event is cancelled

Implements org.bukkit.event.Cancellable.

Definition at line 92 of file InventoryMoveItemEvent.java.

92  {
93  return cancelled;
94  }
void org.bukkit.event.inventory.InventoryMoveItemEvent.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.

Parameters
canceltrue if you wish to cancel this event

Implements org.bukkit.event.Cancellable.

Definition at line 96 of file InventoryMoveItemEvent.java.

96  {
97  this.cancelled = cancel;
98  }
void org.bukkit.event.inventory.InventoryMoveItemEvent.setItem ( ItemStack  itemStack)

Sets the ItemStack being moved; if this is different from the original ItemStack, the original item will not be removed from the source inventory.

Parameters
itemStackThe ItemStack

Definition at line 68 of file InventoryMoveItemEvent.java.

68  {
69  Validate.notNull(itemStack, "ItemStack cannot be null. Cancel the event if you want nothing to be transferred.");
70  this.itemStack = itemStack.clone();
71  }

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