package config; import manager.STableManager; import manager.Table; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @Table(name ="GMMaster") public class SGMMaster implements BaseConfig { private int id; private int type; private int[][] price; private int[][] unlock; private int packID; private static Map> typeMap = new HashMap<>(); private static Map map = new HashMap<>(); @Override public void init() throws Exception { Map config = STableManager.getConfig(SGMMaster.class); Map> map1 = new HashMap<>(); Map map2 = new HashMap<>(); for (SGMMaster master : config.values()) { List list = map1.get(master.getType()); if (list == null){ List masters = config.values().stream().filter(v -> v.getType() == master.getType()).collect(Collectors.toList()); map1.put(master.getType(), masters); } map2.put(master.getPackID(), master); } typeMap.clear(); typeMap = map1; map.clear(); map = map2; } public static Map> getTypeMap() { return typeMap; } public static Map getMap() { return map; } public int getId() { return id; } public int getType() { return type; } public int[][] getPrice() { return price; } public int[][] getUnlock() { return unlock; } public int getPackID() { return packID; } }