Skip to content

Commit

Permalink
Messages.yml file is now moved when updating to 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Jan 25, 2021
1 parent 90127d8 commit 753d283
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.William278</groupId>
<artifactId>HuskHomes</artifactId>
<version>2.1.0</version>
<version>2.1</version>
<packaging>jar</packaging>

<name>HuskHomes</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ public static void checkStartupMigration() {
Bukkit.getLogger().info("Moved old messages.yml --> HuskHomes/MigratedData/OLD_messages.yml");
}
}
} else {
if (config.getInt("config_file_version") == 1) {
config.set("config_file_version", 2);
String language = config.getString("language");
if (language != null) {
if (language.length() == 5) {
File messagesFile = new File(plugin.getDataFolder() + File.separator + "OLD_messages_" + language + ".yml");
if (messagesFile.exists()) {
if (!messagesFile.renameTo(new File("messages " + language + ".yml"))) {
Bukkit.getLogger().warning("Failed to move messages file (System error)! Please delete it and regenerate it!");
} else {
Bukkit.getLogger().info("The language file has been moved as it needs regenerating!");
}
}
} else {
Bukkit.getLogger().warning("Failed to move messages file (Invalid language format)! Please delete it and regenerate it!");
}
} else {
Bukkit.getLogger().warning("Failed to move messages file (Missing language string)! Please delete it and regenerate it!");
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ economy_integration:
make_home_public: 50
random_teleport: 20
handle_vanished_players: true
config_file_version: 1
config_file_version: 2

0 comments on commit 753d283

Please sign in to comment.