More data changes

This commit is contained in:
Auxilor
2021-11-12 11:07:43 +00:00
parent f5ff484086
commit 4788f036ee
2 changed files with 5 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ class DataListener : Listener {
@EventHandler
fun onLeave(event: PlayerQuitEvent) {
PlayerUtils.updateSavedDisplayName(event.player)
(Eco.getHandler().playerProfileHandler as EcoPlayerProfileHandler).savePlayerBlocking(event.player.uniqueId)
(Eco.getHandler().playerProfileHandler as EcoPlayerProfileHandler).unloadPlayer(event.player.uniqueId)
Eco.getHandler().ecoPlugin.logger.info("Player ${event.player.name} Quit (Saving)")
}

View File

@@ -33,7 +33,6 @@ class EcoPlayerProfileHandler(
}
fun unloadPlayer(uuid: UUID) {
handler.saveAllBlocking(listOf(uuid))
loaded.remove(uuid)
}
@@ -41,6 +40,10 @@ class EcoPlayerProfileHandler(
handler.savePlayer(uuid)
}
fun savePlayerBlocking(uuid: UUID) {
handler.saveAllBlocking(listOf(uuid))
}
override fun saveAll() {
handler.saveAll(loaded.keys.toList())
}