You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -926,7 +926,8 @@ index 0000000000000000000000000000000000000000..be64437ba7630fe069aaea502932b514
926
926
+ static final String GLOBAL_CONFIG_FILE_NAME = "paper-global.yml";
927
927
+ static final String WORLD_DEFAULTS_CONFIG_FILE_NAME = "paper-world-defaults.yml";
928
928
+ static final String WORLD_CONFIG_FILE_NAME = "paper-world.yml";
929
-
+ private static final Path BACKUP_DIR = Path.of("legacy-backup");
929
+
+ public static final String CONFIG_DIR = "config";
930
+
+ private static final String BACKUP_DIR ="legacy-backup";
930
931
+
931
932
+ private static final String GLOBAL_HEADER = """
932
933
+ This is the global configuration file for Paper.
@@ -1139,12 +1140,23 @@ index 0000000000000000000000000000000000000000..be64437ba7630fe069aaea502932b514
1139
1140
+ public static PaperConfigurations setup(final Path legacyConfig, final Path configDir, final Path worldFolder, final File spigotConfig) throws Exception {
+ final Path legacyConfigBackup = configDir.resolve(BACKUP_DIR).resolve(legacyConfig.getFileName().toString() + ".old");
1143
+
+ if (Files.exists(configDir) && !Files.isDirectory(configDir)) {
1144
+
+ throw new RuntimeException("Paper needs to create a '" + CONFIG_DIR + "' folder in the root of your server. You already have a non-directory named '" + CONFIG_DIR + "'. Please remove it and restart the server.");
1145
+
+ }
1146
+
+ final Path backupDir = configDir.resolve(BACKUP_DIR);
1147
+
+ if (Files.exists(backupDir) && !Files.isDirectory(backupDir)) {
1148
+
+ throw new RuntimeException("Paper needs to create a '" + BACKUP_DIR + "' directory in the '" + CONFIG_DIR + "' folder. You already have a non-directory named '" + BACKUP_DIR + "'. Please remove it and restart the server.");
1149
+
+ }
1150
+
+ Files.createDirectories(backupDir);
1151
+
+ final String backupFileName = legacyConfig.getFileName().toString() + ".old";
1152
+
+ final Path legacyConfigBackup = backupDir.resolve(backupFileName);
1153
+
+ if (Files.exists(legacyConfigBackup) && !Files.isRegularFile(legacyConfigBackup)) {
1154
+
+ throw new RuntimeException("Paper needs to create a '" + backupFileName + "' file in the '" + BACKUP_DIR + "' folder. You already have a non-file named '" + backupFileName + "'. Please remove it and restart the server.");
1155
+
+ }
1144
1156
+ Files.move(legacyConfig, legacyConfigBackup, StandardCopyOption.REPLACE_EXISTING); // make backup
0 commit comments