package cx.sfy.TheBridge.managers; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.bukkit.configuration.ConfigurationSection; import cx.sfy.TheBridge.Main; import cx.sfy.TheBridge.cosmetics.cages.Cage; public class CageManager { Main plugin; private HashMap cages = new HashMap(); private List unlocked = null; private List locked = null; private List noPerm = null; public CageManager(Main plugin) { this.plugin = plugin; loadCages(); } public void loadCages() { List un = new ArrayList(); for (String u : plugin.getCages().getList("unlocked")) { un.add(u); } unlocked = un; List lo = new ArrayList(); for (String l : plugin.getCages().getList("locked")) { lo.add(l); } locked = lo; List pe = new ArrayList(); for (String p : plugin.getCages().getList("noPerm")) { pe.add(p); } noPerm = pe; ConfigurationSection conf = plugin.getCages().getConfig().getConfigurationSection("cages"); for (String cage : conf.getKeys(false)) { cages.put(cage, new Cage(plugin, "cages." + cage, cage)); } } public Cage getCageByName(String name) { if (cages.containsKey(name)) { return cages.get(name); } return null; } public HashMap getCages() { return cages; } public List getUnlocked() { return unlocked; } public List getLocked() { return locked; } public List getNoPerm() { return noPerm; } }