mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-10 13:49:11 +01:00
Add check for existing config file. Addresses BUKKIT-1851
By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
parent
23a8e4efe3
commit
d4f4e9f5d1
@ -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()}.
|
* 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.
|
* 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();
|
public void saveDefaultConfig();
|
||||||
|
|
||||||
|
@ -133,8 +133,10 @@ public abstract class JavaPlugin extends PluginBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void saveDefaultConfig() {
|
public void saveDefaultConfig() {
|
||||||
|
if (!new File(getDataFolder(), "config.yml").exists()) {
|
||||||
saveResource("config.yml", false);
|
saveResource("config.yml", false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void saveResource(String resourcePath, boolean replace) {
|
public void saveResource(String resourcePath, boolean replace) {
|
||||||
if (resourcePath == null || resourcePath.equals("")) {
|
if (resourcePath == null || resourcePath.equals("")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user