Populates default gates after migrating config to update default gates for old installations
This commit is contained in:
		| @@ -381,8 +381,12 @@ public class Stargate extends JavaPlugin { | |||||||
|         this.reloadConfig(); |         this.reloadConfig(); | ||||||
|         newConfig = this.getConfig(); |         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); |             migrateConfig(newConfig); | ||||||
|  |             isMigrating = true; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         // Copy default values if required |         // Copy default values if required | ||||||
| @@ -399,6 +403,11 @@ public class Stargate extends JavaPlugin { | |||||||
|         debuggingEnabled = newConfig.getBoolean("debugging.debug"); |         debuggingEnabled = newConfig.getBoolean("debugging.debug"); | ||||||
|         permissionDebuggingEnabled = newConfig.getBoolean("debugging.permissionDebug"); |         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 |         //Gates | ||||||
|         loadGateConfig(); |         loadGateConfig(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -397,7 +397,7 @@ public class GateHandler { | |||||||
|      * |      * | ||||||
|      * @param gateFolder <p>The folder containing gate config files</p> |      * @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("nethergate.gate", gateFolder); | ||||||
|         loadGateFromJar("watergate.gate", gateFolder); |         loadGateFromJar("watergate.gate", gateFolder); | ||||||
|         loadGateFromJar("endgate.gate", gateFolder); |         loadGateFromJar("endgate.gate", gateFolder); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user