21 lines
620 B
Kotlin
21 lines
620 B
Kotlin
package nl.voidcorp.mainplugin
|
|
|
|
import org.bukkit.event.EventHandler
|
|
import org.bukkit.event.Listener
|
|
import org.bukkit.event.player.PlayerJoinEvent
|
|
import org.jetbrains.exposed.sql.transactions.transaction
|
|
|
|
|
|
object VoidEvents : Listener {
|
|
|
|
@EventHandler
|
|
fun onJoin(evt: PlayerJoinEvent) {
|
|
transaction {
|
|
val nick = Nick.find { NickTable.userid eq evt.player.uniqueId }.firstOrNull()?.nickname
|
|
if (nick != null) {
|
|
evt.player.setDisplayName(nick)
|
|
}
|
|
}
|
|
evt.joinMessage = "Hello ${evt.player.displayName}, and welcome to the server!"
|
|
}
|
|
} |