示例#1
0
 @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();
   }
 }
示例#2
0
 public static void addPermission(String key) {
   if (!hasPermission(key)) {
     perm.add(key);
     save();
   }
 }
示例#3
0
 public static void removePermission(String key) {
   perm.remove(key);
   save();
 }
示例#4
0
 public static void setValue(String key, Object value) {
   map.put(key, value);
   save();
 }