Skip to content

Commit

Permalink
fix(migration): Add warning message about migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorinwasher committed Nov 14, 2024
1 parent ea9de86 commit d76cdd9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/org/sgrewritten/stargate/Stargate.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,12 @@ private void registerListeners() {
*/
private boolean migrateConfigurationAndData() throws IOException, InvalidConfigurationException, SQLException, StargateInitializationException, URISyntaxException {
DataMigrator dataMigrator = new DataMigrator(new File(this.getDataFolder(), StargateConstant.CONFIG_FILE), this.getDataFolder(), this.getStoredPropertiesAPI());

if (dataMigrator.getConfigVersion() <= 6) {
try (InputStream inputStream = Stargate.class.getResourceAsStream("/messages/migrationInit.txt")) {
String initMessage = FileHelper.readStreamToString(inputStream);
getLogger().severe(initMessage);
}
}
if (dataMigrator.isMigrationNecessary()) {
File debugDirectory = new File(this.getDataFolder(), "debug");
if (!debugDirectory.isDirectory() && !debugDirectory.mkdir()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,8 @@ private boolean isMigrationNecessary(DataMigration dataMigration) {
return dataMigration.getConfigVersion() > configVersion;
}

public int getConfigVersion(){
return configVersion;
}

}
5 changes: 5 additions & 0 deletions src/main/resources/messages/migrationInit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
You are upgrading from a legacy version to a rewritten version.

This involves upgrading your server's Stargate data to a new format.

Your old data has been moved to plugins\stargate\debug\legacy.

0 comments on commit d76cdd9

Please sign in to comment.