소스 검색

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

T00thpick1 12 년 전
부모
커밋
4ea3d690db
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      src/main/java/com/gmail/nossr50/skills/unarmed/Unarmed.java

+ 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;
     }
 }