Beispiel #1
0
 public void saveConfig() {
   if (fileConfiguration != null && myFile != null && !myFile.exists()) {
     try {
       getConfig().save(myFile);
     } catch (IOException ex) {
       plugin.getLogger().log(Level.SEVERE, "Could not save config to " + myFile, ex);
     }
   }
 }
Beispiel #2
0
  public void reloadConfig() {
    fileConfiguration = YamlConfiguration.loadConfiguration(myFile);

    // Look for defaults in the jar
    InputStream defConfigStream = plugin.getResource(fileName);
    if (defConfigStream != null) {
      YamlConfiguration defConfig =
          YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream));
      fileConfiguration.setDefaults(defConfig);
    }
  }
Beispiel #3
0
  public SSFileAccessor(SSSShot plugin, String fileName, String dir) {
    this.plugin = plugin;
    this.fileName = fileName;
    if (dir != null) {
      this.fileName = dir + File.separator + fileName;
    }

    File dataFolder = plugin.getDataFolder();
    if (dataFolder == null) throw new IllegalStateException();

    this.myFile = new File(dataFolder, fileName);
  }