Fixed broken isWaterBottle() check

This commit is contained in:
TfT_02 2014-07-15 17:50:39 +02:00
parent 30085e1e34
commit dedbdf890a
2 changed files with 7 additions and 4 deletions

View File

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

View File

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