コード例 #1
0
  @SuppressWarnings("deprecation")
  public void reloadPlayerConfig() {

    if (playerConfigFile == null) {
      playerConfigFile = new File(plugin.getDataFolder(), "players.yml");
    }
    playerConfig = YamlConfiguration.loadConfiguration(playerConfigFile);
    // Look for defaults in the jar
    InputStream defConfigStream = plugin.getResource("players.yml");
    if (defConfigStream != null) {
      YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
      playerConfig.setDefaults(defConfig);
    }
  }
コード例 #2
0
 public void savePlayerConfig() {
   if (playerConfig == null || playerConfigFile == null) {
     return;
   }
   try {
     getPlayerConfig().save(playerConfigFile);
   } catch (IOException ex) {
     plugin.getLogger().log(Level.SEVERE, "Could not save config to " + playerConfigFile, ex);
   }
 }