Paper/CraftBukkit-Patches/0035-InventoryClickEvent-now-can-return-if-the-click-was-.patch

40 lines
2.7 KiB
Diff

From d7e2842e4c89045f0f2eed6ac58a6326daa905d0 Mon Sep 17 00:00:00 2001
From: Tyler Blair <hidendra@griefcraft.com>
Date: Tue, 9 Apr 2013 17:55:15 -0300
Subject: [PATCH] InventoryClickEvent now can return if the click was a double
click. Fixes Bukkit-4035.
Added in MC 1.5 you can now double click an item which brings all items of that type onto your cursor from the container. There is currently no way to distinguish this from a normal click.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index a2d95e3..a1c2442 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1183,12 +1183,12 @@ public class PlayerConnection extends Connection {
InventoryView inventory = this.player.activeContainer.getBukkitView();
SlotType type = CraftInventoryView.getSlotType(inventory, packet102windowclick.slot);
- InventoryClickEvent event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, packet102windowclick.button != 0, packet102windowclick.shift == 1);
+ InventoryClickEvent event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, packet102windowclick.button != 0, packet102windowclick.shift == 1, packet102windowclick.shift == 6);
org.bukkit.inventory.Inventory top = inventory.getTopInventory();
if (packet102windowclick.slot == 0 && top instanceof CraftingInventory) {
org.bukkit.inventory.Recipe recipe = ((CraftingInventory) top).getRecipe();
if (recipe != null) {
- event = new org.bukkit.event.inventory.CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, packet102windowclick.button != 0, packet102windowclick.shift == 1);
+ event = new org.bukkit.event.inventory.CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, packet102windowclick.button != 0, packet102windowclick.shift == 1, packet102windowclick.shift == 6);
}
}
server.getPluginManager().callEvent(event);
@@ -1276,7 +1276,7 @@ public class PlayerConnection extends Connection {
slot = SlotType.OUTSIDE;
}
- InventoryClickEvent event = new InventoryClickEvent(inventory, slot, slot == SlotType.OUTSIDE ? -999 : packet107setcreativeslot.slot, false, false);
+ InventoryClickEvent event = new InventoryClickEvent(inventory, slot, slot == SlotType.OUTSIDE ? -999 : packet107setcreativeslot.slot, false, false, false);
server.getPluginManager().callEvent(event);
org.bukkit.inventory.ItemStack item = event.getCurrentItem();
--
1.8.2.1