forked from xjboss/KCauldronX
Add new version API getClickedInventory
This commit is contained in:
parent
b1e1c4abb1
commit
2b91f4ebb2
@ -0,0 +1,36 @@
|
|||||||
|
--- ../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.
|
Loading…
Reference in New Issue
Block a user