Add PlayerPickItemEvent
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
+ public org.bukkit.inventory.InventoryHolder getOwner() {
|
||||
+ return this.player.getBukkitEntity();
|
||||
+ }
|
||||
|
||||
+
|
||||
+ @Override
|
||||
+ public int getMaxStackSize() {
|
||||
+ return this.maxStack;
|
||||
@@ -59,7 +59,7 @@
|
||||
+ public void setMaxStackSize(int size) {
|
||||
+ this.maxStack = size;
|
||||
+ }
|
||||
+
|
||||
|
||||
+ @Override
|
||||
+ public Location getLocation() {
|
||||
+ return this.player.getBukkitEntity().getLocation();
|
||||
@@ -98,3 +98,29 @@
|
||||
public int getFreeSlot() {
|
||||
for (int i = 0; i < this.items.size(); ++i) {
|
||||
if (((ItemStack) this.items.get(i)).isEmpty()) {
|
||||
@@ -69,8 +145,10 @@
|
||||
return -1;
|
||||
}
|
||||
|
||||
- public void addAndPickItem(ItemStack stack) {
|
||||
- this.selected = this.getSuitableHotbarSlot();
|
||||
+ // Paper start - Add PlayerPickItemEvent
|
||||
+ public void addAndPickItem(ItemStack stack, final int targetSlot) {
|
||||
+ this.selected = targetSlot;
|
||||
+ // Paper end - Add PlayerPickItemEvent
|
||||
if (!((ItemStack) this.items.get(this.selected)).isEmpty()) {
|
||||
int i = this.getFreeSlot();
|
||||
|
||||
@@ -82,8 +160,10 @@
|
||||
this.items.set(this.selected, stack);
|
||||
}
|
||||
|
||||
- public void pickSlot(int slot) {
|
||||
- this.selected = this.getSuitableHotbarSlot();
|
||||
+ // Paper start - Add PlayerPickItemEvent
|
||||
+ public void pickSlot(int slot, final int targetSlot) {
|
||||
+ this.selected = targetSlot;
|
||||
+ // Paper end - Add PlayerPickItemEvent
|
||||
ItemStack itemstack = (ItemStack) this.items.get(this.selected);
|
||||
|
||||
this.items.set(this.selected, (ItemStack) this.items.get(slot));
|
||||
|
||||
Reference in New Issue
Block a user