forked from xjboss/KCauldronX
37 lines
1.3 KiB
Diff
37 lines
1.3 KiB
Diff
--- ../src-base/minecraft/org/bukkit/event/inventory/InventoryClickEvent.java
|
|
+++ ../src-work/minecraft/org/bukkit/event/inventory/InventoryClickEvent.java
|
|
@@ -52,7 +52,7 @@
|
|
private int rawSlot;
|
|
private ItemStack current = null;
|
|
private int hotbarKey = -1;
|
|
-
|
|
+ private Inventory clickedInventory=null;
|
|
@Deprecated
|
|
public InventoryClickEvent(InventoryView view, SlotType type, int slot, boolean right, boolean shift) {
|
|
this(view, type, slot, right ? (shift ? ClickType.SHIFT_RIGHT : ClickType.RIGHT) : (shift ? ClickType.SHIFT_LEFT : ClickType.LEFT), InventoryAction.SWAP_WITH_CURSOR);
|
|
@@ -64,6 +64,13 @@
|
|
this.rawSlot = slot;
|
|
this.whichSlot = view.convertSlot(slot);
|
|
this.click = click;
|
|
+ if(slot < 0) {
|
|
+ this.clickedInventory = null;
|
|
+ } else if(view.getTopInventory() != null && slot < view.getTopInventory().getSize()) {
|
|
+ this.clickedInventory = view.getTopInventory();
|
|
+ } else {
|
|
+ this.clickedInventory = view.getBottomInventory();
|
|
+ }
|
|
this.action = action;
|
|
}
|
|
|
|
@@ -101,7 +108,9 @@
|
|
}
|
|
return getView().getItem(rawSlot);
|
|
}
|
|
-
|
|
+ public Inventory getClickedInventory(){
|
|
+ return this.clickedInventory;
|
|
+ }
|
|
/**
|
|
* Gets whether or not the ClickType for this event represents a right
|
|
* click.
|