package config; import manager.STableManager; import manager.Table; import java.util.HashMap; import java.util.Map; @Table(name ="ExploreFight") public class SExploreFight implements BaseConfig { private int id; private float fightDown; private float fightUp; private float loseFight; public static Map exploreFight; @Override public void init() throws Exception { Map config = STableManager.getConfig(SExploreFight.class); Map tempExploreFight = new HashMap<>(); for(Map.Entry entry:config.entrySet()){ tempExploreFight.put(entry.getKey(),entry.getValue()); } exploreFight = tempExploreFight; } public int getId() { return id; } public float getFightDown() { return fightDown; } public float getFightUp() { return fightUp; } public float getLoseFight() { return loseFight; } public static Map getExploreFight() { return exploreFight; } public static SExploreFight getConfigByFightDownAndFightUp(float ratio){ for(SExploreFight data:exploreFight.values()){ if(ratio>= data.fightDown&& data.fightUp>= ratio){ return data; } } return null; } }