diff --git a/src/com/massivecraft/mcore/util/MUtil.java b/src/com/massivecraft/mcore/util/MUtil.java index a6c7ef17..12e9d6b4 100644 --- a/src/com/massivecraft/mcore/util/MUtil.java +++ b/src/com/massivecraft/mcore/util/MUtil.java @@ -314,15 +314,28 @@ public class MUtil public static int getPotionEffectBits(ItemStack item) { return item.getDurability() & 0x3F; - } + } + + /** + * Checks if the given potion is a vial of water. + * + * @param item the item to check + * @return true if it's a water vial + */ + public static boolean isWaterPotion(ItemStack item) + { + return getPotionEffectBits(item) == 0; + } public static List getPotionEffects(ItemStack itemStack) { if (itemStack == null) return null; if (itemStack.getType() != Material.POTION) return null; - + List ret = new ArrayList(); + if (isWaterPotion(itemStack)) return ret; + Potion potion = Potion.fromDamage(getPotionEffectBits(itemStack)); ret.addAll(potion.getEffects());