From 11a744a77229c748f55ab10856bd7c76e3b48a2c Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Fri, 11 Mar 2016 22:07:27 -0500 Subject: [PATCH] Properly calculate potionstage --- .../datatypes/skills/alchemy/PotionStage.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/alchemy/PotionStage.java b/src/main/java/com/gmail/nossr50/datatypes/skills/alchemy/PotionStage.java index 93146bce4..a46f1d4da 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/alchemy/PotionStage.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/alchemy/PotionStage.java @@ -2,7 +2,9 @@ package com.gmail.nossr50.datatypes.skills.alchemy; import java.util.List; +import org.bukkit.Material; import org.bukkit.potion.Potion; +import org.bukkit.potion.PotionData; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionType; @@ -47,22 +49,22 @@ public enum PotionStage { } public static PotionStage getPotionStage(AlchemyPotion alchemyPotion) { - Potion potion = alchemyPotion.toPotion(1); + PotionData data = alchemyPotion.getData(); List effects = alchemyPotion.getEffects(); int stage = 1; - // Check if potion isn't awkward or mundane - // Check for custom effects added by mcMMO - if (potion.getType() != null || !effects.isEmpty()) { + // Check if potion has base effect + if (data.getType().getEffectType() != null) { stage++; } // Check if potion has a glowstone dust amplifier // Else check if the potion has a custom effect with an amplifier added by mcMMO - if (potion.getLevel() > 1) { + if (data.isUpgraded()) { stage++; - }else if(!effects.isEmpty()){ + } + if(!effects.isEmpty()){ for (PotionEffect effect : effects){ if(effect.getAmplifier() > 0){ stage++; @@ -72,12 +74,12 @@ public enum PotionStage { } // Check if potion has a redstone dust amplifier - if (potion.hasExtendedDuration()) { + if (data.isExtended()) { stage++; } // Check if potion has a gunpowder amplifier - if (potion.isSplash()) { + if (alchemyPotion.getMaterial() == Material.SPLASH_POTION || alchemyPotion.getMaterial() == Material.LINGERING_POTION) { stage++; }