Esempio n. 1
0
 public List<String> list(String world, String string) {
   if (!world.equals("*") && _worlds.containsKey(world)) {
     YamlConfiguration yaml = _worlds.get(world);
     if (yaml.isSet(string)) {
       return yaml.getStringList(string);
     }
   }
   if (_global.isSet(string)) {
     return _global.getStringList(string);
   }
   return null;
 }
Esempio n. 2
0
 public ConfigProxy(FileConfiguration global, File dir) {
   _global = global;
   if (!_global.isSet("version")
       || !_global.getString("version").equalsIgnoreCase(_configversion)) {
     try {
       _global.save(new File(dir, "config_" + _configversion + ".yml"));
     } catch (Throwable t) {
       t.printStackTrace();
     }
     for (String s : _global.getKeys(false).toArray(new String[0])) {
       _global.set(s, null);
     }
   }
   for (File file : dir.listFiles()) {
     if (!file.isFile()) {
       continue;
     }
     String string = file.getName();
     if (string.matches("world_(.*)\\.yml")) {
       String world = string.substring(6, string.length() - 4);
       YamlConfiguration yaml = new YamlConfiguration();
       try {
         yaml.load(file);
       } catch (Throwable t) {
         t.printStackTrace();
       }
       yaml.set("world", world);
       _worlds.put(world, yaml);
     }
   }
   for (String world : _worlds.keySet().toArray(new String[0])) {
     YamlConfiguration yaml = _worlds.get(world);
     if (yaml.isSet("copy")) {
       if (_worlds.containsKey(yaml.getString("copy"))) {
         if (_worlds.get(yaml.getString("copy")) == yaml) {
           _log.severe(
               "[VirtualPack] World \""
                   + world
                   + "\" copies configuration of world \""
                   + yaml.getString("copy")
                   + "\" which results in a loop!");
           _log.severe("[VirtualPack] Disabling VirtualPack on world \"" + world + "\"!");
           yaml.set("enabled", "false");
         } else {
           _worlds.put(world, _worlds.get(yaml.getString("copy")));
         }
       } else {
         _log.severe(
             "[VirtualPack] World \""
                 + world
                 + "\" copies configuration of world \""
                 + yaml.getString("copy")
                 + "\", but there is no config for this world!");
         _log.severe("[VirtualPack] Disabling VirtualPack on world \"" + world + "\"!");
         yaml.set("enabled", "false");
       }
     }
   }
   setDefs();
   for (Map.Entry<String, Object> entry :
       _global.getConfigurationSection("blacklist").getValues(false).entrySet()) {
     if (entry.getValue() instanceof ConfigurationSection) {
       _blacklists.put(
           entry.getKey().toLowerCase(),
           new ConfigBlacklist((ConfigurationSection) entry.getValue()));
     }
   }
   for (String s : _global.getStringList("transmutation.god-items")) {
     _godItems.add(new ComparativeItemStack(s));
   }
 }
Esempio n. 3
0
 public boolean isSet(String world, String string) {
   return (!world.equals("*") && _worlds.containsKey(world))
       ? _worlds.get(world).isSet(string)
       : _global.isSet(string);
 }
Esempio n. 4
0
 private void setDef(String path, Object value) {
   if (!_global.isSet(path)) {
     _global.set(path, value);
   }
 }