Populates default gates after migrating config to update default gates for old installations

This commit is contained in:
Kristian Knarvik 2021-10-12 20:41:45 +02:00
parent 5b6e3f81a6
commit 4bdc5b6bd9
2 changed files with 11 additions and 2 deletions

View File

@ -381,8 +381,12 @@ public class Stargate extends JavaPlugin {
this.reloadConfig();
newConfig = this.getConfig();
if (newConfig.getString("lang") != null) {
boolean isMigrating = false;
if (newConfig.getString("lang") != null ||
newConfig.getString("gates.integrity.ignoreEntrance") != null ||
newConfig.getString("ignoreEntrance") != null) {
migrateConfig(newConfig);
isMigrating = true;
}
// Copy default values if required
@ -399,6 +403,11 @@ public class Stargate extends JavaPlugin {
debuggingEnabled = newConfig.getBoolean("debugging.debug");
permissionDebuggingEnabled = newConfig.getBoolean("debugging.permissionDebug");
//If users have an outdated config, assume they also need to update their default gates
if (isMigrating) {
GateHandler.populateDefaults(gateFolder);
}
//Gates
loadGateConfig();

View File

@ -397,7 +397,7 @@ public class GateHandler {
*
* @param gateFolder <p>The folder containing gate config files</p>
*/
private static void populateDefaults(String gateFolder) {
public static void populateDefaults(String gateFolder) {
loadGateFromJar("nethergate.gate", gateFolder);
loadGateFromJar("watergate.gate", gateFolder);
loadGateFromJar("endgate.gate", gateFolder);