Don't remove world config when world is saved

This commit is contained in:
Daniel Saukel 2020-05-01 15:27:21 +02:00
parent 64650ca9d5
commit 612fb6828e
2 changed files with 6 additions and 4 deletions

View File

@ -59,7 +59,7 @@ public class DResourceWorld implements ResourceWorld {
folder.mkdir();
}
File configFile = new File(folder, "config.yml");
File configFile = new File(folder, WorldConfig.FILE_NAME);
if (configFile.exists()) {
config = new WorldConfig(plugin, configFile);
}
@ -72,7 +72,7 @@ public class DResourceWorld implements ResourceWorld {
this.folder = folder;
File configFile = new File(folder, "config.yml");
File configFile = new File(folder, WorldConfig.FILE_NAME);
if (configFile.exists()) {
config = new WorldConfig(plugin, configFile);
}
@ -110,7 +110,7 @@ public class DResourceWorld implements ResourceWorld {
*/
public WorldConfig getConfig(boolean generate) {
if (config == null) {
File file = new File(folder, "config.yml");
File file = new File(folder, WorldConfig.FILE_NAME);
if (file.exists()) {
try {
file.createNewFile();
@ -299,7 +299,7 @@ public class DResourceWorld implements ResourceWorld {
void clearFolder() {
for (File file : FileUtil.getFilesForFolder(getFolder())) {
if (file.getName().equals(SignData.FILE_NAME)) {
if (file.getName().equals(SignData.FILE_NAME) || file.getName().equals(WorldConfig.FILE_NAME)) {
continue;
}
if (file.isDirectory()) {

View File

@ -38,6 +38,8 @@ public class WorldConfig extends GameRuleContainer {
private DungeonsXL plugin;
public static final String FILE_NAME = "config.yml";
private File file;
private ConfigurationSection config;