@SuppressWarnings("unchecked") public static void load() { File f = new File(DataManager.getDirectory(), "database"); try { if (!f.exists()) { f.getParentFile().mkdirs(); f.createNewFile(); save(); return; } FileInputStream fis = new FileInputStream(f); ObjectInput in = new ObjectInputStream(fis); map = (HashMap<String, Object>) in.readObject(); try { perm = (ArrayList<String>) in.readObject(); } catch (Exception e) { } fis.close(); in.close(); } catch (Exception e) { e.printStackTrace(); } }
public static void addPermission(String key) { if (!hasPermission(key)) { perm.add(key); save(); } }
public static void removePermission(String key) { perm.remove(key); save(); }
public static void setValue(String key, Object value) { map.put(key, value); save(); }