mirror of
https://github.com/devproje/px32-bot.git
synced 2024-11-26 10:43:05 +00:00
fix: handler bug fixed
This commit is contained in:
parent
60965ee92e
commit
a360e53d0f
4 changed files with 6 additions and 12 deletions
|
@ -1,5 +1,6 @@
|
|||
plugins {
|
||||
kotlin("jvm") version "2.0.20"
|
||||
id("org.jetbrains.dokka") version "1.9.20"
|
||||
kotlin("plugin.serialization") version "2.0.20"
|
||||
}
|
||||
|
||||
|
@ -14,6 +15,7 @@ val sqlite_version: String by project
|
|||
val postgres_version: String by project
|
||||
|
||||
allprojects {
|
||||
apply(plugin = "org.jetbrains.dokka")
|
||||
apply(plugin = "org.jetbrains.kotlin.jvm")
|
||||
apply(plugin = "org.jetbrains.kotlin.plugin.serialization")
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ kotlin.code.style=official
|
|||
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8
|
||||
|
||||
group=net.projecttl
|
||||
version=0.2.2-SNAPSHOT
|
||||
version=0.2.3-SNAPSHOT
|
||||
|
||||
ktor_version=2.3.12
|
||||
log4j_version=2.23.1
|
||||
|
|
|
@ -90,14 +90,10 @@ class CoreKernel(token: String) {
|
|||
memLock.lock()
|
||||
}
|
||||
|
||||
val newHandlers = mutableListOf<ListenerAdapter>()
|
||||
PluginLoader.destroy()
|
||||
plugins.forEach { plugin ->
|
||||
plugin.handlers.forEach { handler ->
|
||||
if (handlers.contains(handler)) {
|
||||
jda.removeEventListener(handler)
|
||||
handlers.remove(handler)
|
||||
}
|
||||
plugin.handlers.filter { handlers.contains(it) }.map {
|
||||
handlers.remove(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,15 +104,11 @@ class CoreKernel(token: String) {
|
|||
plugin.handlers.forEach { handler ->
|
||||
if (!handlers.contains(handler)) {
|
||||
handlers.add(handler)
|
||||
newHandlers.add(handler)
|
||||
jda.addEventListener(handler)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handlers.map {
|
||||
jda.addEventListener(it)
|
||||
}
|
||||
|
||||
handlers.forEach { h ->
|
||||
if (h is CommandHandler) {
|
||||
h.register(jda)
|
||||
|
|
BIN
wh64@192.168.10.12
Normal file
BIN
wh64@192.168.10.12
Normal file
Binary file not shown.
Loading…
Reference in a new issue