Discussion in 'Bukkit Preview' started by deltahat, Dec 30, 2011.

  1. Offline


    Feature Overview
    Plugin.saveResource() and Plugin.saveDefaultConfig() are two new methods that make working with plugin resources much easier.

    Plugin.saveResource() is used to copy any embedded .jar resource into the plugin's default directory. The saveResource() method is especially useful during initial plugin startup for creating the initial versions of configuration files, localization .properties files, or any other files the plugin needs in its default directory to run. A special feature of the saveResource() method is that it preserves the internal directory structure of your .jar file when extracting a file into the default directory. Any subdirectories in the default directory will be created as needed by saveResource().

    Plugin.saveDefaultConfig() is a special version of Plugin.saveResource() that copies the default config.yml file from your plugin's .jar file to the correct place in the default directory. Since Plugin.saveDefaultConfig() is based on Plugin.saveResource(), all the comments and formatting in your default config.yml file are perfectly preserved.

    For an example of how to use both Plugin.saveResource() and Plugin.saveDefaultConfig(), see

Share This Page