Merge pull request #2614 from ThundrRok/master

Fix for custom potions being missed in potion stage calculation. #2386
This commit is contained in:
t00thpick1 2015-07-18 11:22:48 -04:00
commit ac3b28da8b

View File

@ -1,6 +1,9 @@
package com.gmail.nossr50.datatypes.skills.alchemy;
import java.util.List;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionEffect;
public enum PotionStage {
FIVE(5),
@ -44,17 +47,27 @@ public enum PotionStage {
public static PotionStage getPotionStage(AlchemyPotion alchemyPotion) {
Potion potion = alchemyPotion.toPotion(1);
List<PotionEffect> effects = alchemyPotion.getEffects();
int stage = 1;
// Check if potion isn't awkward or mundane
if (potion.getType() != null) {
// Check for custom effects added by mcMMO
if (potion.getType() != null || !effects.isEmpty()) {
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) {
stage++;
}else if(!effects.isEmpty()){
for (PotionEffect effect : effects){
if(effect.getAmplifier() > 0){
stage++;
break;
}
}
}
// Check if potion has a redstone dust amplifier