1.0 #7

Merged
edraft merged 11 commits from 1.0 into master 2023-06-16 10:40:06 +02:00
3 changed files with 44 additions and 0 deletions
Showing only changes of commit 9f4d25e90f - Show all commits

View File

@ -1,6 +1,8 @@
package de.sh_edraft
import de.sh_edraft.config.Config
import de.sh_edraft.events.OnJoinListener
import de.sh_edraft.events.OnLeaveListener
import org.bukkit.plugin.java.JavaPlugin
open class OntimeHandlerPlugin() : JavaPlugin() {
@ -12,6 +14,10 @@ open class OntimeHandlerPlugin() : JavaPlugin() {
this.config.read("/config.properties", false)
this.config.read("/config.${this.config.environment}.properties", true)
this.config.read("/config.${this.config.hostName}.properties", true)
server.pluginManager.registerEvents(OnJoinListener(logger), this)
server.pluginManager.registerEvents(OnLeaveListener(logger), this)
logger.info("OntimeHandlerPlugin enabled :D")
}

View File

@ -0,0 +1,13 @@
package de.sh_edraft.events
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerJoinEvent
import java.util.logging.Logger
class OnJoinListener(private val logger: Logger) : Listener {
@EventHandler
fun onPlayerJoin(p: PlayerJoinEvent) {
logger.info("Player ${p.player.player?.displayName} joined")
}
}

View File

@ -0,0 +1,25 @@
package de.sh_edraft.events
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerEvent
import org.bukkit.event.player.PlayerKickEvent
import org.bukkit.event.player.PlayerQuitEvent
import java.util.logging.Logger
class OnLeaveListener(private val logger: Logger) : Listener {
private fun handleQuit(p: PlayerEvent) {
this.logger.info("Player ${p.player.player?.displayName} leaved")
}
@EventHandler
fun onPlayerQuit(p: PlayerQuitEvent) {
this.handleQuit(p)
}
@EventHandler
fun onPlayerKick(p: PlayerKickEvent) {
this.handleQuit(p)
}
}