mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Fix for custom potions being missed in potion stage calculation. #2386
This commit is contained in:
parent
93ad040936
commit
d3d7c254f4
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user