Cleaned up data desync PR

This commit is contained in:
Auxilor
2023-04-29 15:52:13 +01:00
parent 714952bc45
commit 43b7c393b9
2 changed files with 5 additions and 6 deletions

View File

@@ -22,7 +22,7 @@ class ProfileHandler(
private val type: HandlerType,
private val plugin: EcoSpigotPlugin
) {
val loaded = mutableMapOf<UUID, Profile>()
private val loaded = mutableMapOf<UUID, EcoProfile>()
val handler: DataHandler = when (type) {
HandlerType.YAML -> YamlDataHandler(plugin, this)
@@ -41,6 +41,9 @@ class ProfileHandler(
}
}
fun accessLoadedProfile(uuid: UUID): EcoProfile? =
loaded[uuid]
fun loadGenericProfile(uuid: UUID): Profile {
val found = loaded[uuid]
if (found != null) {

View File

@@ -18,11 +18,7 @@ class ProfileSaver(
val uuid = iterator.next()
iterator.remove()
val profile = handler.loaded[uuid] ?: continue
if (profile !is EcoProfile) {
continue
}
val profile = handler.accessLoadedProfile(uuid) ?: continue
handler.saveKeysFor(uuid, profile.data.keys)
}