Example #1
0
 private void initConfig() {
   plugin.saveDefaultConfig(); // creates a copy of the provided config.yml in the plugins data
   // folder, if it does not exist
   config =
       plugin.getConfig(); // re-reads config out of memory. (Reads the config from file only, when
   // invoked the first time!)
 }
Example #2
0
 private void
     saveConfig() // saves the config to disc (needed when entries have been altered via the plugin
       // in-game)
     {
   // get and set values here!
   plugin.saveConfig();
 }
Example #3
0
  // reloads the config from disc (used if user made manual changes to the config.yml file)
  public void reloadConfig(CommandSender sender) {
    plugin.reloadConfig();
    config =
        plugin
            .getConfig(); // new assignment necessary when returned value is assigned to a variable
    // or static field(!)
    plugin.readConfigValues();

    sender.sendMessage(
        "["
            + ChatColor.GREEN
            + "Info"
            + ChatColor.WHITE
            + "] "
            + ChatColor.GREEN
            + plugin.getDescription().getName()
            + " "
            + plugin.getDescription().getVersion()
            + " reloaded!");
  }
Example #4
0
  public CPConfigHandler(CartProtect plugin) {
    this.plugin = plugin;
    config = plugin.getConfig();

    initConfig();
  }