org.bukkit.event.inventory
Class InventoryClickEvent

java.lang.Object
  extended by org.bukkit.event.Event
      extended by org.bukkit.event.inventory.InventoryEvent
          extended by org.bukkit.event.inventory.InventoryClickEvent
All Implemented Interfaces:
Cancellable
Direct Known Subclasses:
CraftItemEvent

public class InventoryClickEvent
extends InventoryEvent
implements Cancellable


Nested Class Summary
 
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
 
Field Summary
 
Fields inherited from class org.bukkit.event.inventory.InventoryEvent
transaction
 
Constructor Summary
InventoryClickEvent(InventoryView what, InventoryType.SlotType type, int slot, boolean right, boolean shift)
           
 
Method Summary
 ItemStack getCurrentItem()
          Get the current item in the clicked slot.
 ItemStack getCursor()
          Get the current item on the cursor.
static HandlerList getHandlerList()
           
 HandlerList getHandlers()
           
 int getRawSlot()
          The raw slot number, which is unique for the view.
 Event.Result getResult()
           
 int getSlot()
          The slot number that was clicked, ready for passing to Inventory.getItem(int).
 InventoryType.SlotType getSlotType()
          Get the type of slot that was clicked.
 HumanEntity getWhoClicked()
          Get the player who performed the click.
 boolean isCancelled()
          Gets the cancellation state of this event.
 boolean isLeftClick()
           
 boolean isRightClick()
           
 boolean isShiftClick()
          Shift can be combined with right-click or left-click as a modifier.
 void setCancelled(boolean toCancel)
          Sets the cancellation state of this event.
 void setCurrentItem(ItemStack what)
          Set the current item in the slot.
 void setCursor(ItemStack what)
          Set the item on the cursor.
 void setResult(Event.Result newResult)
           
 
Methods inherited from class org.bukkit.event.inventory.InventoryEvent
getInventory, getView, getViewers
 
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InventoryClickEvent

public InventoryClickEvent(InventoryView what,
                           InventoryType.SlotType type,
                           int slot,
                           boolean right,
                           boolean shift)
Method Detail

getSlotType

public InventoryType.SlotType getSlotType()
Get the type of slot that was clicked.

Returns:
The slot type.

getCursor

public ItemStack getCursor()
Get the current item on the cursor.

Returns:
The cursor item

getCurrentItem

public ItemStack getCurrentItem()
Get the current item in the clicked slot.

Returns:
The slot item.

isRightClick

public boolean isRightClick()
Returns:
True if the click is a right-click.

isLeftClick

public boolean isLeftClick()
Returns:
True if the click is a left-click.

isShiftClick

public boolean isShiftClick()
Shift can be combined with right-click or left-click as a modifier.

Returns:
True if the click is a shift-click.

setResult

public void setResult(Event.Result newResult)

getResult

public Event.Result getResult()

getWhoClicked

public HumanEntity getWhoClicked()
Get the player who performed the click.

Returns:
The clicking player.

setCursor

public void setCursor(ItemStack what)
Set the item on the cursor.

Parameters:
what - The new cursor item.

setCurrentItem

public void setCurrentItem(ItemStack what)
Set the current item in the slot.

Parameters:
what - The new slot item.

isCancelled

public boolean isCancelled()
Description copied from interface: Cancellable
Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

Specified by:
isCancelled in interface Cancellable
Returns:
true if this event is cancelled

setCancelled

public void setCancelled(boolean toCancel)
Description copied from interface: Cancellable
Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

Specified by:
setCancelled in interface Cancellable
Parameters:
toCancel - true if you wish to cancel this event

getSlot

public int getSlot()
The slot number that was clicked, ready for passing to Inventory.getItem(int). Note that there may be two slots with the same slot number, since a view links two different inventories.

Returns:
The slot number.

getRawSlot

public int getRawSlot()
The raw slot number, which is unique for the view.

Returns:
The slot number.

getHandlers

public HandlerList getHandlers()
Overrides:
getHandlers in class InventoryEvent

getHandlerList

public static HandlerList getHandlerList()


Copyright © 2013. All Rights Reserved.