diff options
author | Wesley Wolfe <weswolf@aol.com> | 2012-06-23 21:31:57 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2012-06-28 16:39:19 -0500 |
commit | 34b63c06cc2a3e7ab25b69c047893c477ab500ba (patch) | |
tree | 8032a4617099e7518b0e9d7649fd436e5efd3cbf /src/main/java/org/bukkit | |
parent | d3bf76da9de67e7cd6e97d80086f2aa907930fb7 (diff) | |
download | bukkit-34b63c06cc2a3e7ab25b69c047893c477ab500ba.tar bukkit-34b63c06cc2a3e7ab25b69c047893c477ab500ba.tar.gz bukkit-34b63c06cc2a3e7ab25b69c047893c477ab500ba.tar.lz bukkit-34b63c06cc2a3e7ab25b69c047893c477ab500ba.tar.xz bukkit-34b63c06cc2a3e7ab25b69c047893c477ab500ba.zip |
Add check for existing config file. Addresses BUKKIT-1851
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r-- | src/main/java/org/bukkit/plugin/Plugin.java | 1 | ||||
-rw-r--r-- | src/main/java/org/bukkit/plugin/java/JavaPlugin.java | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java index 05a2c696..6b75c3e7 100644 --- a/src/main/java/org/bukkit/plugin/Plugin.java +++ b/src/main/java/org/bukkit/plugin/Plugin.java @@ -58,6 +58,7 @@ public interface Plugin extends CommandExecutor { /** * Saves the raw contents of the default config.yml file to the location retrievable by {@link #getConfig()}. * If there is no default config.yml embedded in the plugin, an empty config.yml file is saved. + * This should fail silently if the config.yml already exists. */ public void saveDefaultConfig(); diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java index b7ecc181..cdc6e751 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java @@ -133,7 +133,9 @@ public abstract class JavaPlugin extends PluginBase { } public void saveDefaultConfig() { - saveResource("config.yml", false); + if (!new File(getDataFolder(), "config.yml").exists()) { + saveResource("config.yml", false); + } } public void saveResource(String resourcePath, boolean replace) { |