Cleaned up data desync PR
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user