SendLeftPlayer when plugin is disabled
This commit is contained in:
parent
00ab06cb62
commit
bc5f7f4d9b
@ -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 :(")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user