diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/EcoSkillsPlugin.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/EcoSkillsPlugin.java index 74a532b..b950777 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/EcoSkillsPlugin.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/EcoSkillsPlugin.java @@ -53,7 +53,10 @@ public class EcoSkillsPlugin extends EcoPlugin { effectsYml = new EffectsYml(this); dataHandler = this.getConfigYml().getBool("mysql.enabled") ? new MySQLDataHandler(this) : new YamlDataHandler(this); + } + @Override + protected void handleEnable() { LegacyPlayerProfile.Companion.migrateAll(); } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/legacy/LegacyPlayerProfile.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/legacy/LegacyPlayerProfile.kt index 943ec77..e2d3038 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/legacy/LegacyPlayerProfile.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/data/legacy/LegacyPlayerProfile.kt @@ -1,5 +1,6 @@ package com.willfp.ecoskills.data.legacy +import com.willfp.eco.core.Eco import com.willfp.eco.core.data.PlayerProfile import com.willfp.eco.core.data.keys.PersistentDataKey import com.willfp.ecoskills.EcoSkillsPlugin @@ -54,12 +55,17 @@ class LegacyPlayerProfile private constructor( plugin.logger.info("so there's no need to worry about how long it takes. Once this is complete,") plugin.logger.info("feel free to delete data.yml as it won't be used anymore") plugin.logger.info("-----------------------------------------") + Bukkit.getLogger().info(keys.toString()) + Bukkit.getLogger().info(mappedKeys.toString()) for (offlinePlayer in Bukkit.getServer().offlinePlayers) { plugin.logger.info("Migrating player ${offlinePlayer.uniqueId}...") migrate(offlinePlayer) } - plugin.logger.info("Migration complete!") + plugin.logger.info("Saving...") plugin.configYml.set("mysql.migrated", true) + plugin.configYml.save() + Eco.getHandler().playerProfileHandler.saveAll(false) + plugin.logger.info("Migration complete!") } private fun migrate(player: OfflinePlayer) { diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index d8eeea4..11f07b1 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -8,7 +8,7 @@ # This exists purely to be able to migrate player data # Go to /plugins/eco/config.yml to change MySQL settings mysql: - migrated: false # Internal value - DO NOT CHANGE + migrated: false # Internal value - DO NOT CHANGE, YOU RISK LOSING PLAYER DATA enabled: false # Set to false, data.yml will be used instead. host: localhost port: 3306