9
0
mirror of https://github.com/Auxilor/EcoSkills.git synced 2026-01-02 05:46:57 +00:00

Fixed automigrateor

This commit is contained in:
Auxilor
2021-11-03 19:20:41 +00:00
parent 8eb5d22076
commit dc3de8f791
3 changed files with 11 additions and 2 deletions

View File

@@ -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();
}

View File

@@ -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) {

View File

@@ -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