Jelajahi Sumber

Fix Dupe bug...... why was this overlooked?

T00thpick1 12 tahun lalu
induk
melakukan
4ea3d690db

+ 4 - 1
src/main/java/com/gmail/nossr50/skills/unarmed/Unarmed.java

@@ -29,9 +29,9 @@ public class Unarmed {
     public static boolean handleItemPickup(PlayerInventory inventory, Item drop) {
         ItemStack dropStack = drop.getItemStack();
         int firstEmpty = inventory.firstEmpty();
+        int dropAmount = dropStack.getAmount();
 
         if (inventory.containsAtLeast(dropStack, 1)) {
-            int dropAmount = dropStack.getAmount();
             int nextSlot = 0;
 
             for (Iterator<ItemStack> iterator = inventory.iterator(); iterator.hasNext();) {
@@ -72,6 +72,7 @@ public class Unarmed {
 
                 if (itemstack == null) {
                     drop.remove();
+                    dropStack.setAmount(dropAmount);
                     inventory.setItem(nextSlot, dropStack);
                     return true;
                 }
@@ -80,6 +81,8 @@ public class Unarmed {
             }
         }
 
+        dropStack.setAmount(dropAmount); // Even when only partially finished we need to prevent dupes
+
         return false;
     }
 }