|
@@ -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<PotionEffect> 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++;
|
|
|
}
|
|
|
|