Explorar o código

Fixed broken isWaterBottle() check

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

+ 5 - 0
src/main/java/com/gmail/nossr50/datatypes/skills/alchemy/AlchemyPotion.java

@@ -7,6 +7,7 @@ import java.util.Map.Entry;
 import org.bukkit.Material;
 import org.bukkit.inventory.ItemStack;
 import org.bukkit.inventory.meta.PotionMeta;
+import org.bukkit.potion.Potion;
 import org.bukkit.potion.PotionEffect;
 
 public class AlchemyPotion {
@@ -50,6 +51,10 @@ public class AlchemyPotion {
         return potion;
     }
 
+    public Potion toPotion(int amount) {
+        return Potion.fromItemStack(this.toItemStack(amount));
+    }
+
     public short getDataValue() {
         return dataValue;
     }

+ 2 - 4
src/main/java/com/gmail/nossr50/datatypes/skills/alchemy/PotionStage.java

@@ -1,7 +1,5 @@
 package com.gmail.nossr50.datatypes.skills.alchemy;
 
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
 import org.bukkit.potion.Potion;
 
 public enum PotionStage {
@@ -41,11 +39,11 @@ public enum PotionStage {
     }
 
     private static boolean isWaterBottle(AlchemyPotion input) {
-        return input.getEffects().isEmpty();
+        return input.toPotion(1).getEffects().isEmpty();
     }
 
     public static PotionStage getPotionStage(AlchemyPotion alchemyPotion) {
-        Potion potion = Potion.fromItemStack(new ItemStack(Material.POTION, 1, alchemyPotion.getDataValue()));
+        Potion potion = alchemyPotion.toPotion(1);
 
         int stage = 1;