2013-11-16 00:21:00 +01:00
|
|
|
package com.gmail.nossr50.skills.alchemy;
|
|
|
|
|
2014-02-12 11:16:05 +01:00
|
|
|
import java.util.ArrayList;
|
2013-11-16 00:21:00 +01:00
|
|
|
import java.util.HashMap;
|
2014-02-12 11:16:05 +01:00
|
|
|
import java.util.List;
|
2013-11-16 00:21:00 +01:00
|
|
|
import java.util.Map;
|
|
|
|
|
2014-01-30 20:45:21 +01:00
|
|
|
import org.bukkit.block.BlockState;
|
2013-11-16 00:21:00 +01:00
|
|
|
|
|
|
|
import com.gmail.nossr50.mcMMO;
|
|
|
|
import com.gmail.nossr50.config.AdvancedConfig;
|
|
|
|
import com.gmail.nossr50.runnables.skills.AlchemyBrewTask;
|
|
|
|
|
|
|
|
public final class Alchemy {
|
|
|
|
public enum Tier {
|
|
|
|
EIGHT(8),
|
|
|
|
SEVEN(7),
|
|
|
|
SIX(6),
|
|
|
|
FIVE(5),
|
|
|
|
FOUR(4),
|
|
|
|
THREE(3),
|
|
|
|
TWO(2),
|
|
|
|
ONE(1);
|
|
|
|
|
|
|
|
int numerical;
|
|
|
|
|
|
|
|
private Tier(int numerical) {
|
|
|
|
this.numerical = numerical;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int toNumerical() {
|
|
|
|
return numerical;
|
|
|
|
}
|
2013-12-31 00:30:58 +01:00
|
|
|
|
2013-11-16 00:21:00 +01:00
|
|
|
public static Tier fromNumerical(int numerical) {
|
|
|
|
for (Tier tier : Tier.values()) {
|
|
|
|
if (tier.toNumerical() == numerical) {
|
|
|
|
return tier;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected int getLevel() {
|
|
|
|
return AdvancedConfig.getInstance().getConcoctionsTierLevel(this);
|
|
|
|
}
|
|
|
|
}
|
2013-12-31 00:30:58 +01:00
|
|
|
|
2014-02-11 22:22:57 +01:00
|
|
|
public static final int INGREDIENT_SLOT = 3;
|
|
|
|
|
2013-11-16 00:21:00 +01:00
|
|
|
public static int catalysisUnlockLevel = AdvancedConfig.getInstance().getCatalysisUnlockLevel();
|
|
|
|
public static int catalysisMaxBonusLevel = AdvancedConfig.getInstance().getCatalysisMaxBonusLevel();
|
|
|
|
public static double catalysisMinSpeed = AdvancedConfig.getInstance().getCatalysisMinSpeed();
|
|
|
|
public static double catalysisMaxSpeed = AdvancedConfig.getInstance().getCatalysisMaxSpeed();
|
|
|
|
|
2014-01-30 20:45:21 +01:00
|
|
|
public static Map<BlockState, AlchemyBrewTask> brewingStandMap = new HashMap<BlockState, AlchemyBrewTask>();
|
2013-11-16 00:21:00 +01:00
|
|
|
|
2013-12-31 00:30:58 +01:00
|
|
|
private Alchemy() {}
|
|
|
|
|
2013-11-16 00:21:00 +01:00
|
|
|
/**
|
|
|
|
* Finish all active brews. Used upon Disable to prevent vanilla potions from being brewed upon next Enable.
|
|
|
|
*/
|
|
|
|
public static void finishAllBrews() {
|
2013-12-31 00:30:58 +01:00
|
|
|
mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
|
2014-02-11 22:22:57 +01:00
|
|
|
|
2014-02-12 11:16:05 +01:00
|
|
|
List<AlchemyBrewTask> toFinish = new ArrayList<AlchemyBrewTask>();
|
|
|
|
|
2013-12-31 00:30:58 +01:00
|
|
|
for (AlchemyBrewTask alchemyBrewTask : brewingStandMap.values()) {
|
2014-02-12 11:16:05 +01:00
|
|
|
toFinish.add(alchemyBrewTask);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (AlchemyBrewTask alchemyBrewTask : toFinish) {
|
2013-12-31 00:30:58 +01:00
|
|
|
alchemyBrewTask.finishImmediately();
|
2013-11-16 00:21:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|