diff --git a/src/main/kotlin/de/sh_edraft/OntimeHandlerPlugin.kt b/src/main/kotlin/de/sh_edraft/OntimeHandlerPlugin.kt index 9379788..0e8fb3a 100644 --- a/src/main/kotlin/de/sh_edraft/OntimeHandlerPlugin.kt +++ b/src/main/kotlin/de/sh_edraft/OntimeHandlerPlugin.kt @@ -4,6 +4,7 @@ import de.sh_edraft.config.Config import de.sh_edraft.data.DataService import de.sh_edraft.events.OnJoinListener import de.sh_edraft.events.OnLeftListener +import org.bukkit.Bukkit import org.bukkit.plugin.java.JavaPlugin open class OntimeHandlerPlugin() : JavaPlugin() { @@ -27,6 +28,16 @@ open class OntimeHandlerPlugin() : JavaPlugin() { } override fun onDisable() { + try { + for (player in Bukkit.getOnlinePlayers()) { + logger.info("Logout player" + player.displayName) + val playerId = this.dataService.getPlayerGlobalId(player.player!!.displayName) ?: return + this.dataService.sendLeftPlayer(playerId) + } + } catch (ex: Exception) { + logger.severe(ex.message) + } + logger.info("OntimeHandlerPlugin disabled :(") } } \ No newline at end of file