Explorar o código

Cleanup finishBrewing a bit

TfT_02 %!s(int64=11) %!d(string=hai) anos
pai
achega
254f3b5ac9

+ 11 - 9
src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java

@@ -101,18 +101,20 @@ public final class AlchemyPotionBrewer {
         }
 
         for (int i = 0; i < 3; i++) {
-            ItemStack item = inventory.getItem(i);
+            ItemStack item = inventory.getItem(i).clone();
 
-            if (!isEmpty(item) && PotionConfig.getInstance().isValidPotion(item)) {
-                AlchemyPotion input = PotionConfig.getInstance().getPotion(item.getDurability());
-                AlchemyPotion output = PotionConfig.getInstance().getPotion(input.getChildDataValue(ingredient));
+            if (isEmpty(item) || !PotionConfig.getInstance().isValidPotion(item)) {
+                continue;
+            }
+
+            AlchemyPotion input = PotionConfig.getInstance().getPotion(item.getDurability());
+            AlchemyPotion output = PotionConfig.getInstance().getPotion(input.getChildDataValue(ingredient));
 
-                if (output != null) {
-                    inventory.setItem(i, output.toItemStack(item.getAmount()).clone());
+            if (output != null) {
+                inventory.setItem(i, output.toItemStack(item.getAmount()).clone());
 
-                    if (player != null) {
-                        UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(1);
-                    }
+                if (player != null) {
+                    UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(1);
                 }
             }
         }