Skip to content

Commit 69e94b5

Browse files
committed
Update config
1 parent 38e3bcf commit 69e94b5

File tree

6 files changed

+14
-168
lines changed

6 files changed

+14
-168
lines changed

Common/src/main/java/systems/kscott/randomspawnplus/config/Config.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,13 @@ public static void createDirectory(File dir) throws IOException {
146146
}
147147

148148
public static String getGlobalConfigHeader() {
149-
return "#############################\n" +
150-
"# RandomSpawnPlus5 #\n" +
151-
"# Version 6.0.0 #\n" +
152-
"# by @89apt89 & @Dreeam #\n" +
153-
"#############################\n";
149+
return """
150+
#############################
151+
# RandomSpawnPlus #
152+
# Version 6.0.0 #
153+
# by @89apt89 & @Dreeam #
154+
#############################
155+
""";
154156
}
155157

156158
public static GlobalConfig getGlobalConfig() {

Common/src/main/java/systems/kscott/randomspawnplus/config/GlobalConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public GlobalConfig(File pluginFolder, String configFileName, boolean init) thro
6363
addCommentRegionBased("config-version",
6464
Config.getGlobalConfigHeader() +
6565
"\n" +
66-
"# NOTE: When modifying values such as spawn-range, and the cache is enabled, you'll need to reset spawns.yml.\n" +
67-
"# This can be accomplished by simply deleting the spawns.yml and restarting the server.\n" +
66+
"NOTE: When modifying values such as spawn-range, and the cache is enabled, you'll need to reset spawns.yml.\n" +
67+
"This can be accomplished by simply deleting the spawns.yml and restarting the server.\n" +
6868
"\n" +
6969
"Don't touch this!\n"
7070
);

Common/src/main/java/systems/kscott/randomspawnplus/config/SpawnStorage.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,18 @@ public FileConfiguration get() {
2626
}
2727

2828
public void reloadConfig() throws IOException, InvalidConfigurationException {
29-
File customConfigFile = createFile();
29+
File customConfigFile = new File(RandomSpawnPlus.getInstance().getDataFolder(), configFileName);
3030
config = new YamlConfiguration();
3131

32-
config.load(customConfigFile);
32+
// If first load, create new file
33+
if (customConfigFile.exists() || customConfigFile.createNewFile()) {
34+
config.load(customConfigFile);
35+
}
3336
}
3437

3538
public void saveConfig() throws IOException {
3639
// TODO: Check here, better way?
3740
String path = Paths.get(RandomSpawnPlus.getInstance().getDataFolder().getAbsolutePath(), configFileName).toString();
3841
config.save(path);
3942
}
40-
41-
private File createFile() {
42-
File customConfigFile = new File(RandomSpawnPlus.getInstance().getDataFolder(), configFileName);
43-
if (!customConfigFile.exists() || customConfigFile.getParentFile().mkdirs()) {
44-
RandomSpawnPlus.getInstance().saveResource(configFileName, false);
45-
}
46-
return customConfigFile;
47-
}
4843
}

Common/src/main/resources/config.yml

Lines changed: 0 additions & 113 deletions
This file was deleted.

Common/src/main/resources/lang.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

Common/src/main/resources/spawns.yml

Whitespace-only changes.

0 commit comments

Comments
 (0)