diff --git a/build.gradle.kts b/build.gradle.kts index 3a08f8bb..07aa375b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,36 +1,32 @@ -@file:Suppress("PropertyName", "SpellCheckingInspection") - -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import io.izzel.taboolib.gradle.* import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -val taboolib_version: String by project - -val kotlinVersionNum: String - get() = project.kotlin.coreLibrariesVersion.replace(".", "") - plugins { java - id("org.jetbrains.kotlin.jvm") version "1.9.0" - id("com.github.johnrengelman.shadow") version "7.1.2" apply false -} - -repositories { - mavenLocal() - mavenCentral() + id("io.izzel.taboolib") version "2.0.2" + id("org.jetbrains.kotlin.jvm") version "1.8.22" } subprojects { apply() + apply(plugin = "io.izzel.taboolib") apply(plugin = "org.jetbrains.kotlin.jvm") - apply(plugin = "com.github.johnrengelman.shadow") + taboolib { + env { + install( + UNIVERSAL, DATABASE, KETHER, METRICS, NMS, NMS_UTIL, UI, + EXPANSION_REDIS, EXPANSION_JAVASCRIPT, EXPANSION_PLAYER_DATABASE, + BUKKIT_ALL, BUNGEE, VELOCITY + ) + } + version { taboolib = "6.1.0" } + } + + // 全局仓库 repositories { mavenLocal() mavenCentral() - maven { - url = uri("http://ptms.ink:8081/repository/releases/") - isAllowInsecureProtocol = true - } maven("https://jitpack.io") maven("https://oss.sonatype.org/content/repositories/snapshots") maven("https://papermc.io/repo/repository/maven-public/") @@ -39,34 +35,15 @@ subprojects { maven("https://repo.codemc.io/repository/maven-public/") } + // 全局依赖 dependencies { compileOnly(kotlin("stdlib")) - compileOnly(fileTree("${rootDir.resolve("libs")}")) compileOnly("com.google.code.gson:gson:2.8.5") compileOnly("com.google.guava:guava:21.0") compileOnly("net.kyori:adventure-api:4.15.0") - implementation("com.eatthepath:fast-uuid:0.2.0") - - compileOnly("io.izzel.taboolib:common:$taboolib_version") - implementation("io.izzel.taboolib:common-5:$taboolib_version") - implementation("io.izzel.taboolib:module-chat:$taboolib_version") - implementation("io.izzel.taboolib:module-configuration:$taboolib_version") - implementation("io.izzel.taboolib:module-database:$taboolib_version") - implementation("io.izzel.taboolib:module-kether:$taboolib_version") - implementation("io.izzel.taboolib:module-lang:$taboolib_version") - implementation("io.izzel.taboolib:module-metrics:$taboolib_version") - implementation("io.izzel.taboolib:module-nms:$taboolib_version") - implementation("io.izzel.taboolib:module-nms-util:$taboolib_version") - implementation("io.izzel.taboolib:module-ui:$taboolib_version") - implementation("io.izzel.taboolib:platform-bukkit:$taboolib_version") - implementation("io.izzel.taboolib:platform-bungee:$taboolib_version") - implementation("io.izzel.taboolib:platform-velocity:$taboolib_version") - implementation("io.izzel.taboolib:expansion-alkaid-redis:$taboolib_version") - implementation("io.izzel.taboolib:expansion-command-helper:$taboolib_version") - implementation("io.izzel.taboolib:expansion-javascript:$taboolib_version") - implementation("io.izzel.taboolib:expansion-player-database:$taboolib_version") } + // 编译配置 java { withSourcesJar() sourceCompatibility = JavaVersion.VERSION_1_8 @@ -81,15 +58,6 @@ subprojects { freeCompilerArgs = listOf("-Xjvm-default=all", "-Xextended-compiler-checks") } } - tasks.withType { - relocate("taboolib", "${rootProject.group}.taboolib") - relocate("kotlin.", "kotlin${kotlinVersionNum}.") { exclude("kotlin.Metadata") } - relocate("com.eatthepath.uuid", "${rootProject.group}.library.uuid") - // Velocity properties - relocate("@plugin_id@", rootProject.name.toLowerCase()) - relocate("@plugin_name@", rootProject.name) - relocate("@plugin_version@", rootProject.version.toString()) - } } gradle.buildFinished { diff --git a/gradle.properties b/gradle.properties index d827d3db..0503e4c0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,5 @@ group=me.arasple.mc.trchat -version=2.0.11 -taboolib_version=6.0.12-local +version=2.0.12 kotlin.incremental=true kotlin.incremental.java=true koltin.incremental.useClasspathSnapshot=true diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index ee87235f..74c7f556 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -1,37 +1,41 @@ -@file:Suppress("PropertyName", "SpellCheckingInspection") - -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar - -val taboolib_version: String by project +taboolib { + description { + name(rootProject.name) + desc("Advanced Minecraft Chat Control") + links { + name("homepage").url("https://trchat.trixey.cc/") + } + contributors { + name("Arasple") + name("ItsFlicker") + } + dependencies { + name("PlaceholderAPI").with("bukkit") + name("DiscordSRV").with("bukkit").optional(true) + name("EcoEnchants").with("bukkit").optional(true) + name("ItemsAdder").with("bukkit").optional(true) + name("Nova").with("bukkit").optional(true) + name("Multiverse-Core").with("bukkit").loadafter(true) + } + } + relocate("com.eatthepath.uuid.", "${rootProject.group}.library.uuid.") +} dependencies { - implementation(project(":project:common")) - implementation(project(":project:module-adventure")) - implementation(project(":project:module-nms")) - implementation(project(":project:runtime-bukkit")) - implementation(project(":project:runtime-bungee")) - implementation(project(":project:runtime-velocity")) + taboo("com.eatthepath:fast-uuid:0.2.0") } tasks { - withType { - archiveBaseName.set(rootProject.name) - archiveClassifier.set("") - // 删除一些不必要的文件 - exclude("META-INF/maven/**") - exclude("META-INF/tf/**") - exclude("module-info.java") + jar { + // 构件名 + archiveFileName.set("${rootProject.name}-${archiveFileName.get().substringAfter('-')}") + // 打包子项目源代码 + rootProject.subprojects.forEach { from(it.sourceSets["main"].output) } } sourcesJar { + // 构件名 archiveFileName.set("${rootProject.name}-${archiveFileName.get().substringAfter('-')}") // 打包子项目源代码 rootProject.subprojects.forEach { from(it.sourceSets["main"].allSource) } } - build { - dependsOn(shadowJar) - } -} - -gradle.buildFinished { - File(buildDir, "libs/${project.name}-${rootProject.version}.jar").delete() } \ No newline at end of file diff --git a/project/common/build.gradle.kts b/project/common/build.gradle.kts index e69de29b..677ec837 100644 --- a/project/common/build.gradle.kts +++ b/project/common/build.gradle.kts @@ -0,0 +1,5 @@ +dependencies { + compileOnly("com.eatthepath:fast-uuid:0.2.0") +} + +taboolib { subproject = true } \ No newline at end of file diff --git a/project/common/src/main/kotlin/me/arasple/mc/trchat/api/impl/DefaultFilterManager.kt b/project/common/src/main/kotlin/me/arasple/mc/trchat/api/impl/DefaultFilterManager.kt index 807fa5b1..ef519927 100644 --- a/project/common/src/main/kotlin/me/arasple/mc/trchat/api/impl/DefaultFilterManager.kt +++ b/project/common/src/main/kotlin/me/arasple/mc/trchat/api/impl/DefaultFilterManager.kt @@ -7,7 +7,8 @@ import me.arasple.mc.trchat.module.internal.filter.FilteredObject import me.arasple.mc.trchat.module.internal.service.Metrics import me.arasple.mc.trchat.util.parseJson import me.arasple.mc.trchat.util.reportOnce -import taboolib.common.env.IO +import taboolib.common.LifeCycle +import taboolib.common.PrimitiveIO import taboolib.common.io.digest import taboolib.common.io.newFile import taboolib.common.platform.Awake @@ -23,10 +24,10 @@ import java.io.File import java.net.URL import java.nio.charset.StandardCharsets -@Awake object DefaultFilterManager : FilterManager { - init { + @Awake(LifeCycle.CONST) + fun init() { PlatformFactory.registerAPI(this) } @@ -104,7 +105,7 @@ object DefaultFilterManager : FilterManager { return kotlin.runCatching { URL(url).openConnection().also { it.connectTimeout = 30 * 1000; it.readTimeout = 30 * 1000 }.getInputStream().use { inputStream -> BufferedInputStream(inputStream).use { bufferedInputStream -> - val origin = IO.readFully(bufferedInputStream, StandardCharsets.UTF_8) + val origin = PrimitiveIO.readFully(bufferedInputStream, StandardCharsets.UTF_8) val database = origin.parseJson().asJsonObject require(database.has("lastUpdateDate") && database.has("words")) { "Wrong database json object" diff --git a/project/common/src/main/kotlin/me/arasple/mc/trchat/api/impl/DefaultTrChatAPI.kt b/project/common/src/main/kotlin/me/arasple/mc/trchat/api/impl/DefaultTrChatAPI.kt index f7794e78..e0df9f1a 100644 --- a/project/common/src/main/kotlin/me/arasple/mc/trchat/api/impl/DefaultTrChatAPI.kt +++ b/project/common/src/main/kotlin/me/arasple/mc/trchat/api/impl/DefaultTrChatAPI.kt @@ -2,6 +2,7 @@ package me.arasple.mc.trchat.api.impl import me.arasple.mc.trchat.TrChat import me.arasple.mc.trchat.api.* +import taboolib.common.LifeCycle import taboolib.common.platform.Awake import taboolib.common.platform.PlatformFactory @@ -9,10 +10,10 @@ import taboolib.common.platform.PlatformFactory * @author ItsFlicker * @since 2022/6/18 15:26 */ -@Awake object DefaultTrChatAPI : TrChatAPI { - init { + @Awake(LifeCycle.CONST) + fun init() { TrChat.register(this) } diff --git a/project/common/src/main/kotlin/me/arasple/mc/trchat/module/internal/service/Updater.kt b/project/common/src/main/kotlin/me/arasple/mc/trchat/module/internal/service/Updater.kt index 08f0b9de..2622c7ce 100644 --- a/project/common/src/main/kotlin/me/arasple/mc/trchat/module/internal/service/Updater.kt +++ b/project/common/src/main/kotlin/me/arasple/mc/trchat/module/internal/service/Updater.kt @@ -2,7 +2,7 @@ package me.arasple.mc.trchat.module.internal.service import me.arasple.mc.trchat.util.parseJson import taboolib.common.LifeCycle -import taboolib.common.env.IO +import taboolib.common.PrimitiveIO import taboolib.common.platform.ProxyPlayer import taboolib.common.platform.SkipTo import taboolib.common.platform.function.console @@ -31,7 +31,7 @@ object Updater { kotlin.runCatching { URL(api_url).openConnection().also { it.connectTimeout = 30 * 1000; it.readTimeout = 30 * 1000 }.getInputStream().use { inputStream -> BufferedInputStream(inputStream).use { bufferedInputStream -> - val read = IO.readFully(bufferedInputStream, StandardCharsets.UTF_8) + val read = PrimitiveIO.readFully(bufferedInputStream, StandardCharsets.UTF_8) val json = read.parseJson().asJsonObject val latestVersion = json["tag_name"].asString.removePrefix("v") latest_Version = Version(latestVersion) diff --git a/project/common/src/main/kotlin/me/arasple/mc/trchat/util/ArrayConverter.kt b/project/common/src/main/kotlin/me/arasple/mc/trchat/util/ArrayConverter.kt new file mode 100644 index 00000000..c1794b83 --- /dev/null +++ b/project/common/src/main/kotlin/me/arasple/mc/trchat/util/ArrayConverter.kt @@ -0,0 +1,14 @@ +package me.arasple.mc.trchat.util + +import taboolib.common.util.asList +import taboolib.library.configuration.Converter + +class ArrayConverter : Converter, Any> { + override fun convertToField(value: Any): Array { + return value.asList().toTypedArray() + } + + override fun convertFromField(value: Array): Any { + return if (value.size == 1) value[0] else value.toList() + } +} \ No newline at end of file diff --git a/project/common/src/main/kotlin/me/arasple/mc/trchat/util/Util.kt b/project/common/src/main/kotlin/me/arasple/mc/trchat/util/Util.kt index a48ee32c..83fdd95a 100644 --- a/project/common/src/main/kotlin/me/arasple/mc/trchat/util/Util.kt +++ b/project/common/src/main/kotlin/me/arasple/mc/trchat/util/Util.kt @@ -5,8 +5,6 @@ import com.google.gson.JsonElement import com.google.gson.JsonParser import me.arasple.mc.trchat.util.proxy.common.MessageBuilder import taboolib.common.platform.function.console -import taboolib.common.util.asList -import taboolib.library.configuration.Converter import java.util.* private val jsonParser = JsonParser() @@ -47,14 +45,4 @@ fun buildMessage(vararg messages: String): List { fun String.toUUID(): UUID = FastUUID.parseUUID(this) -fun UUID.parseString(): String = FastUUID.toString(this) - -class ArrayLikeConverter : Converter, Any> { - override fun convertToField(value: Any): Array { - return value.asList().toTypedArray() - } - - override fun convertFromField(value: Array): Any { - return if (value.size == 1) value[0] else value.toList() - } -} \ No newline at end of file +fun UUID.parseString(): String = FastUUID.toString(this) \ No newline at end of file diff --git a/project/module-adventure/build.gradle.kts b/project/module-adventure/build.gradle.kts index 8354f959..4b50561a 100644 --- a/project/module-adventure/build.gradle.kts +++ b/project/module-adventure/build.gradle.kts @@ -2,4 +2,6 @@ dependencies { compileOnly(project(":project:common")) compileOnly(project(":project:module-nms")) compileOnly("net.kyori:adventure-platform-bukkit:4.3.2") -} \ No newline at end of file +} + +taboolib { subproject = true } \ No newline at end of file diff --git a/project/module-nms/build.gradle.kts b/project/module-nms/build.gradle.kts index a777eaba..780f90b2 100644 --- a/project/module-nms/build.gradle.kts +++ b/project/module-nms/build.gradle.kts @@ -8,4 +8,6 @@ dependencies { compileOnly("ink.ptms.core:v11900:11900:mapped") compileOnly("ink.ptms:nms-all:1.0.0") compileOnly("com.velocitypowered:velocity-brigadier:1.0.0-SNAPSHOT") -} \ No newline at end of file +} + +taboolib { subproject = true } \ No newline at end of file diff --git a/project/runtime-bukkit/build.gradle.kts b/project/runtime-bukkit/build.gradle.kts index 76e0e8b8..103df666 100644 --- a/project/runtime-bukkit/build.gradle.kts +++ b/project/runtime-bukkit/build.gradle.kts @@ -1,9 +1,3 @@ -val taboolib_version: String by project - -plugins { - id("io.izzel.taboolib") version "1.56" -} - repositories { maven("https://nexus.scarsz.me/content/groups/public/") } @@ -14,36 +8,13 @@ dependencies { compileOnly(project(":project:module-nms")) compileOnly("ink.ptms.core:v12004:12004:universal") compileOnly("net.md-5:bungeecord-api:1.20-R0.1-SNAPSHOT") + compileOnly(fileTree("libs")) - compileOnly("me.clip:placeholderapi:2.11.3") { isTransitive = false } + compileOnly("me.clip:placeholderapi:2.11.5") { isTransitive = false } compileOnly("com.discordsrv:discordsrv:1.26.0") { isTransitive = false } compileOnly("com.willfp:eco:6.35.1") { isTransitive = false } compileOnly("com.github.LoneDev6:api-itemsadder:3.6.2-beta-r3-b") { isTransitive = false } compileOnly("xyz.xenondevs.nova:nova-api:0.12.13") { isTransitive = false } } -taboolib { - description { - name(rootProject.name) - desc("Advanced Minecraft Chat Control") - links { - name("homepage").url("https://trchat.trixey.cc/") - } - contributors { - name("Arasple") - name("ItsFlicker") - } - dependencies { - name("PlaceholderAPI").with("bukkit") - name("DiscordSRV").with("bukkit").optional(true) - name("EcoEnchants").with("bukkit").optional(true) - name("ItemsAdder").with("bukkit").optional(true) - name("Nova").with("bukkit").optional(true) - name("Multiverse-Core").loadafter(true) - } - } - install("common", "platform-bukkit") - options("skip-minimize", "keep-kotlin-module", "skip-taboolib-relocate") - classifier = null - version = taboolib_version -} \ No newline at end of file +taboolib { subproject = true } \ No newline at end of file diff --git a/libs/paper-api-1.19.2-R0.1-20220912.114321-31.jar b/project/runtime-bukkit/libs/paper-api-1.19.2-R0.1-20220912.114321-31.jar similarity index 100% rename from libs/paper-api-1.19.2-R0.1-20220912.114321-31.jar rename to project/runtime-bukkit/libs/paper-api-1.19.2-R0.1-20220912.114321-31.jar diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/api/impl/BukkitChannelManager.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/api/impl/BukkitChannelManager.kt index ed4caff8..5b7e2264 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/api/impl/BukkitChannelManager.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/api/impl/BukkitChannelManager.kt @@ -3,17 +3,18 @@ package me.arasple.mc.trchat.api.impl import me.arasple.mc.trchat.api.ChannelManager import me.arasple.mc.trchat.module.conf.Loader import me.arasple.mc.trchat.module.display.channel.Channel +import taboolib.common.LifeCycle import taboolib.common.platform.* /** * @author ItsFlicker * @since 2022/6/19 19:57 */ -@Awake -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object BukkitChannelManager : ChannelManager { - init { + @Awake(LifeCycle.CONST) + fun init() { PlatformFactory.registerAPI(this) } diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/api/impl/BukkitComponentManager.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/api/impl/BukkitComponentManager.kt index 13c77d0e..1c345d41 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/api/impl/BukkitComponentManager.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/api/impl/BukkitComponentManager.kt @@ -25,7 +25,7 @@ import java.util.* * @author ItsFlicker * @since 2022/6/8 12:56 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object BukkitComponentManager : ComponentManager { @ConfigNode("Enable.Chat", "filter.yml") diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/api/impl/BukkitProxyManager.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/api/impl/BukkitProxyManager.kt index 733980c2..23675cae 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/api/impl/BukkitProxyManager.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/api/impl/BukkitProxyManager.kt @@ -32,7 +32,7 @@ import java.util.concurrent.Future * @since 2022/6/18 15:43 */ @Suppress("Deprecation") -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object BukkitProxyManager : ClientMessageManager { override var port = 25565 diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/Loader.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/Loader.kt index 4c816266..adfc8c18 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/Loader.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/Loader.kt @@ -44,7 +44,7 @@ import kotlin.system.measureTimeMillis * @author ItsFlicker * @since 2021/12/12 13:45 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object Loader { private val folder by unsafeLazy { @@ -77,23 +77,9 @@ object Loader { filterChannelFiles(folder).forEach { if (FileWatcher.INSTANCE.hasListener(it)) { - try { - loadChannel(it.nameWithoutExtension, YamlConfiguration.loadConfiguration(it)).let { channel -> - Channel.channels[channel.id] = channel - } - } catch (t: Throwable) { - t.print("Channel file ${it.name} loaded failed!") - } + loadChannel(it) } else { - FileWatcher.INSTANCE.addSimpleListener(it, { - try { - loadChannel(it.nameWithoutExtension, YamlConfiguration.loadConfiguration(it)).let { channel -> - Channel.channels[channel.id] = channel - } - } catch (t: Throwable) { - t.print("Channel file ${it.name} loaded failed!") - } - }, true) + FileWatcher.INSTANCE.addSimpleListener(it, { loadChannel(it) }, true) } } @@ -101,6 +87,16 @@ object Loader { return Channel.channels.size } + fun loadChannel(file: File) { + try { + loadChannel(file.nameWithoutExtension, YamlConfiguration.loadConfiguration(file)).let { channel -> + Channel.channels[channel.id] = channel + } + } catch (t: Throwable) { + t.print("Channel file ${file.name} loaded failed!") + } + } + fun loadChannel(id: String, conf: YamlConfiguration): Channel { Channel.channels[id]?.let { it.unregister() diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/file/Filters.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/file/Filters.kt index 7f02b185..fc87b169 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/file/Filters.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/file/Filters.kt @@ -14,7 +14,7 @@ import taboolib.module.configuration.Configuration * @author ItsFlicker * @since 2022/2/4 13:04 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object Filters { @Config("filter.yml") diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/file/Functions.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/file/Functions.kt index da15858c..99e11df0 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/file/Functions.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/file/Functions.kt @@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit * @author ItsFlicker * @since 2021/12/12 11:40 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object Functions { @Config("function.yml", autoReload = true) diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/file/Settings.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/file/Settings.kt index 6b3692ed..b9c60cb5 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/file/Settings.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/conf/file/Settings.kt @@ -17,7 +17,7 @@ import taboolib.module.kether.Kether * @author ItsFlicker * @since 2021/12/11 23:59 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object Settings { @Config("settings.yml") diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/EnderChestShow.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/EnderChestShow.kt index 4d06dc92..a7c4f4bb 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/EnderChestShow.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/EnderChestShow.kt @@ -27,7 +27,7 @@ import taboolib.module.configuration.ConfigNode import taboolib.module.configuration.ConfigNodeTransfer import taboolib.module.nms.MinecraftVersion import taboolib.module.ui.buildMenu -import taboolib.module.ui.type.Linked +import taboolib.module.ui.type.PageableChest import taboolib.platform.util.* /** @@ -35,7 +35,7 @@ import taboolib.platform.util.* * @since 2022/3/18 19:14 */ @StandardFunction -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object EnderChestShow : Function("ENDERCHEST") { override val alias = "EnderChest-Show" @@ -111,7 +111,7 @@ object EnderChestShow : Function("ENDERCHEST") { if (cache.getIfPresent(sha1) != null) { return sha1 to cache.getIfPresent(sha1)!!.serializeToByteArray().encodeBase64() } - val menu = buildMenu>(sender.asLangText("Function-EnderChest-Show-Title", sender.name)) { + val menu = buildMenu>(sender.asLangText("Function-EnderChest-Show-Title", sender.name)) { rows(3) slots((0..26).toList()) elements { (0..26).map { inventory.getItem(it).replaceAir() } } diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/ImageShow.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/ImageShow.kt index 5e022d45..49cbc65d 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/ImageShow.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/ImageShow.kt @@ -32,7 +32,7 @@ import java.util.concurrent.CompletableFuture * @since 2022/3/12 19:14 */ @StandardFunction -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ImageShow : Function("IMAGE") { override val alias = "Image-Show" diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/InventoryShow.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/InventoryShow.kt index 6256fb9d..3dfb1b37 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/InventoryShow.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/InventoryShow.kt @@ -27,7 +27,7 @@ import taboolib.module.configuration.ConfigNode import taboolib.module.configuration.ConfigNodeTransfer import taboolib.module.nms.MinecraftVersion import taboolib.module.ui.buildMenu -import taboolib.module.ui.type.Linked +import taboolib.module.ui.type.PageableChest import taboolib.platform.util.* /** @@ -35,7 +35,7 @@ import taboolib.platform.util.* * @since 2022/3/18 19:14 */ @StandardFunction -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object InventoryShow : Function("INVENTORY") { override val alias = "Inventory-Show" @@ -114,7 +114,7 @@ object InventoryShow : Function("INVENTORY") { if (cache.getIfPresent(sha1) != null) { return sha1 to cache.getIfPresent(sha1)!!.serializeToByteArray().encodeBase64() } - val menu = buildMenu>(sender.asLangText("Function-Inventory-Show-Title", sender.name)) { + val menu = buildMenu>(sender.asLangText("Function-Inventory-Show-Title", sender.name)) { rows(6) slots(inventorySlots) elements { diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/ItemShow.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/ItemShow.kt index 62ae6459..6fb91ff5 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/ItemShow.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/ItemShow.kt @@ -34,8 +34,8 @@ import taboolib.module.configuration.ConfigNode import taboolib.module.configuration.ConfigNodeTransfer import taboolib.module.nms.* import taboolib.module.ui.buildMenu -import taboolib.module.ui.type.Basic -import taboolib.module.ui.type.Linked +import taboolib.module.ui.type.Chest +import taboolib.module.ui.type.PageableChest import taboolib.platform.util.* /** @@ -43,7 +43,7 @@ import taboolib.platform.util.* * @since 2022/3/12 19:14 */ @StandardFunction -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ItemShow : Function("ITEM") { override val alias = "Item-Show" @@ -170,7 +170,7 @@ object ItemShow : Function("ITEM") { val blockStateMeta = item.itemMeta!! as BlockStateMeta val shulkerBox = blockStateMeta.blockState as ShulkerBox val shulkerInv = shulkerBox.inventory - buildMenu>(sender.asLangText("Function-Item-Show-Title", sender.name)) { + buildMenu>(sender.asLangText("Function-Item-Show-Title", sender.name)) { rows(3) slots((0..26).toList()) elements { (0..26).map { shulkerInv.getItem(it).replaceAir() } } @@ -178,7 +178,7 @@ object ItemShow : Function("ITEM") { onClick(lock = true) } } else { - buildMenu(sender.asLangText("Function-Item-Show-Title", sender.name)) { + buildMenu(sender.asLangText("Function-Item-Show-Title", sender.name)) { rows(3) map( "xxxxxxxxx", diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/Mention.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/Mention.kt index 9ee809e3..0f7517ca 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/Mention.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/Mention.kt @@ -25,7 +25,7 @@ import taboolib.module.configuration.ConfigNodeTransfer * @since 2022/3/18 19:14 */ @StandardFunction -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object Mention : Function("MENTION") { override val alias = "Mention" diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/MentionAll.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/MentionAll.kt index 7654bb4f..92b15368 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/MentionAll.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/function/standard/MentionAll.kt @@ -25,7 +25,7 @@ import taboolib.platform.util.sendLang * @since 2022/3/18 19:14 */ @StandardFunction -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object MentionAll : Function("MENTIONALL") { override val alias = "Mention-All" diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/menu/MenuFilterControl.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/menu/MenuFilterControl.kt index 603246eb..90840d99 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/menu/MenuFilterControl.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/display/menu/MenuFilterControl.kt @@ -8,7 +8,7 @@ import taboolib.common.platform.PlatformSide import taboolib.library.xseries.XMaterial import taboolib.library.xseries.XSound import taboolib.module.ui.openMenu -import taboolib.module.ui.type.Basic +import taboolib.module.ui.type.Chest import taboolib.platform.util.buildItem /** @@ -16,13 +16,13 @@ import taboolib.platform.util.buildItem * @date 2019/11/30 11:40 * Internal Menu For Chat Filter Control */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object MenuFilterControl { private val SOUND = XSound.BLOCK_NOTE_BLOCK_PLING fun displayFor(player: Player) { - player.openMenu("TrChat Filter") { + player.openMenu("TrChat Filter") { rows(5) map( "#########", diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/TrChatBukkit.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/TrChatBukkit.kt index 7002f481..e914f7a1 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/TrChatBukkit.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/TrChatBukkit.kt @@ -11,13 +11,14 @@ import me.arasple.mc.trchat.module.display.function.Function import me.arasple.mc.trchat.module.internal.data.PlayerData import me.arasple.mc.trchat.module.internal.hook.HookPlugin import org.bukkit.Bukkit +import taboolib.common.LifeCycle import taboolib.common.platform.* import taboolib.common.platform.function.console import taboolib.common.platform.function.pluginVersion import taboolib.module.lang.sendLang import taboolib.module.nms.MinecraftVersion.majorLegacy -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object TrChatBukkit : Plugin() { var isPaperEnv = false @@ -25,7 +26,7 @@ object TrChatBukkit : Plugin() { var isGlobalMuting = false - @Awake + @Awake(LifeCycle.CONST) internal fun detectPaperEnv() { try { // Paper 1.16.5+ diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/CommandHandler.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/CommandHandler.kt index bf09a7be..f1f9e67b 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/CommandHandler.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/CommandHandler.kt @@ -23,7 +23,7 @@ import taboolib.platform.util.sendLang * @author ItsFlicker * @since 2021/8/21 12:23 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) @CommandHeader("trchat", ["trc"], "TrChat main command", permission = "trchat.access") object CommandHandler { diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandChannel.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandChannel.kt index 9eea19da..dd9d02a1 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandChannel.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandChannel.kt @@ -14,7 +14,7 @@ import taboolib.module.lang.sendLang * @author ItsFlicker * @since 2021/7/21 11:24 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object CommandChannel { @Awake(LifeCycle.ENABLE) diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandIgnore.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandIgnore.kt index 76341a8c..b1d505f2 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandIgnore.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandIgnore.kt @@ -20,7 +20,7 @@ import taboolib.platform.util.sendLang * @author ItsFlicker * @since 2022/2/6 15:01 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object CommandIgnore { @Awake(LifeCycle.ENABLE) diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandMute.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandMute.kt index b627e33b..71295650 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandMute.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandMute.kt @@ -26,7 +26,7 @@ import java.text.SimpleDateFormat * @author ItsFlicker * @since 2021/7/21 10:40 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object CommandMute { val muteDateFormat = SimpleDateFormat() diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandReply.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandReply.kt index 44ad2d4b..82ae8395 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandReply.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandReply.kt @@ -22,7 +22,7 @@ import taboolib.platform.util.sendLang * @author ItsFlicker * @since 2021/7/21 11:14 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object CommandReply { val lastMessageFrom = HashMap() diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandViews.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandViews.kt index 224d0a14..6970f2d2 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandViews.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/main/CommandViews.kt @@ -20,7 +20,7 @@ import taboolib.platform.util.sendLang * @author ItsFlicker * @since 2022/2/6 15:01 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object CommandViews { @Awake(LifeCycle.ENABLE) diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/sub/CommandColor.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/sub/CommandColor.kt index 1954e0cd..9a9a0407 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/sub/CommandColor.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/sub/CommandColor.kt @@ -11,7 +11,7 @@ import taboolib.common.platform.command.subCommand * @author ItsFlicker * @since 2022/6/15 17:49 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object CommandColor { val command = subCommand { diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/sub/CommandRecallMessage.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/sub/CommandRecallMessage.kt index 8c619b69..40a9fedf 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/sub/CommandRecallMessage.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/command/sub/CommandRecallMessage.kt @@ -14,7 +14,7 @@ import taboolib.platform.util.onlinePlayers * @author ItsFlicker * @since 2021/8/11 12:08 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object CommandRecallMessage { val command = subCommand { diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/data/ChatLogs.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/data/ChatLogs.kt index 3a9e5ad2..a43e6396 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/data/ChatLogs.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/data/ChatLogs.kt @@ -19,7 +19,7 @@ import java.util.concurrent.TimeUnit * @author Arasple * @date 2019/11/30 16:08 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ChatLogs { private val waveList = mutableListOf() diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/data/Databases.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/data/Databases.kt index 18b2ed09..26eafba3 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/data/Databases.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/data/Databases.kt @@ -13,7 +13,7 @@ import taboolib.expansion.setupPlayerDatabase * @author ItsFlicker * @since 2021/9/11 13:29 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object Databases { @Awake(LifeCycle.ENABLE) diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/hook/HookPlugin.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/hook/HookPlugin.kt index 8e06e614..8df3adec 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/hook/HookPlugin.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/hook/HookPlugin.kt @@ -17,7 +17,7 @@ import java.util.function.BiFunction * @author Arasple * @date 2021/1/26 22:04 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object HookPlugin { val registry = arrayListOf( diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/hook/ext/HookPlaceholderAPI.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/hook/ext/HookPlaceholderAPI.kt index ce788458..3182609e 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/hook/ext/HookPlaceholderAPI.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/hook/ext/HookPlaceholderAPI.kt @@ -21,7 +21,7 @@ import taboolib.platform.compat.PlaceholderExpansion * @author Arasple * @since 2021/8/9 23:09 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object HookPlaceholderAPI : PlaceholderExpansion { override val identifier: String diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/hook/impl/HookItemsAdder.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/hook/impl/HookItemsAdder.kt index bdb5ec87..24c37940 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/hook/impl/HookItemsAdder.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/hook/impl/HookItemsAdder.kt @@ -11,10 +11,13 @@ import org.bukkit.entity.Player class HookItemsAdder : HookAbstract() { fun replaceFontImages(message: String, player: Player?): String { - return if (isHooked) { - FontImageWrapper.replaceFontImages(player, message) + if (!isHooked) { + return message + } + return if (player == null) { + FontImageWrapper.replaceFontImages(message) } else { - message + FontImageWrapper.replaceFontImages(player, message) } } } \ No newline at end of file diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerAnvilChange.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerAnvilChange.kt index 206e5242..42eb1e0d 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerAnvilChange.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerAnvilChange.kt @@ -19,7 +19,7 @@ import taboolib.platform.util.modifyMeta * @author ItsFlicker * @date 2019/8/15 21:18 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ListenerAnvilChange { @ConfigNode("Enable.Anvil", "filter.yml") diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerBookEdit.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerBookEdit.kt index 624c7a5f..44a66265 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerBookEdit.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerBookEdit.kt @@ -12,7 +12,7 @@ import taboolib.module.configuration.ConfigNode * @author ItsFlicker * @date 2019/8/15 21:18 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ListenerBookEdit { @ConfigNode("Color.Book", "settings.yml") diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerBukkitChat.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerBukkitChat.kt index 07806432..b0777aa7 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerBukkitChat.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerBukkitChat.kt @@ -21,7 +21,7 @@ import taboolib.platform.util.sendLang * @author ItsFlicker * @date 2019/11/30 12:10 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ListenerBukkitChat { @ConfigNode("Options.Always-Cancel-Chat-Event", "settings.yml") diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerCommand.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerCommand.kt index cd84550d..2fb64e8b 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerCommand.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerCommand.kt @@ -16,7 +16,7 @@ import taboolib.platform.util.sendLang * @author ItsFlicker * @date 2020/1/16 21:41 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ListenerCommand { @SubscribeEvent(priority = EventPriority.LOWEST, ignoreCancelled = true) diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerJoin.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerJoin.kt index 1770f6f3..19db5686 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerJoin.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerJoin.kt @@ -19,7 +19,7 @@ import taboolib.expansion.setupDataContainer * @author ItsFlicker * @since 2021/12/11 23:19 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ListenerJoin { private var hasFetched = false diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerPackets.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerPackets.kt index f32eea88..8a801cd3 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerPackets.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerPackets.kt @@ -13,7 +13,7 @@ import taboolib.module.nms.PacketSendEvent * @author Arasple * @date 2019/11/30 10:16 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ListenerPackets { @ConfigNode("Options.Cheat-Client-Secure-Chat", "settings.yml") diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerPaperChat.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerPaperChat.kt index dd2f5081..f8075b80 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerPaperChat.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerPaperChat.kt @@ -7,7 +7,7 @@ import taboolib.common.platform.PlatformSide import taboolib.common.platform.event.EventPriority import taboolib.common.platform.event.SubscribeEvent -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ListenerPaperChat { @Ghost diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerQuit.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerQuit.kt index bb1817cd..df28f1f6 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerQuit.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerQuit.kt @@ -14,7 +14,7 @@ import taboolib.expansion.releaseDataContainer * @author ItsFlicker * @since 2021/12/11 23:19 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ListenerQuit { @SubscribeEvent(priority = EventPriority.HIGHEST) diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerSignChange.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerSignChange.kt index 1b3a8b17..db3c1097 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerSignChange.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerSignChange.kt @@ -17,7 +17,7 @@ import taboolib.module.configuration.ConfigNode * @author ItsFlicker * @date 2019/8/15 21:18 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ListenerSignChange { @ConfigNode("Enable.Sign", "filter.yml") diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerTabComplete.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerTabComplete.kt index ff74eb05..7b31f33b 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerTabComplete.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerTabComplete.kt @@ -14,7 +14,7 @@ import taboolib.module.configuration.ConfigNode * @author ItsFlicker * @since 2021/10/22 23:25 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object ListenerTabComplete { @ConfigNode("Options.Prevent-Tab-Complete", "settings.yml") var enabled = false diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/proxy/redis/RedisManager.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/proxy/redis/RedisManager.kt index 57a1cd62..88e6eec2 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/proxy/redis/RedisManager.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/proxy/redis/RedisManager.kt @@ -12,7 +12,7 @@ import taboolib.expansion.SingleRedisConnector import taboolib.expansion.fromConfig import taboolib.module.configuration.ConfigNode -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object RedisManager { private var connector: SingleRedisConnector? = null diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/proxy/redis/TrRedisMessage.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/proxy/redis/TrRedisMessage.kt index be7c52f3..0739e8ba 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/proxy/redis/TrRedisMessage.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/proxy/redis/TrRedisMessage.kt @@ -1,9 +1,9 @@ package me.arasple.mc.trchat.module.internal.proxy.redis -import me.arasple.mc.trchat.util.ArrayLikeConverter +import me.arasple.mc.trchat.util.ArrayConverter import taboolib.library.configuration.Conversion class TrRedisMessage( - @Conversion(ArrayLikeConverter::class) + @Conversion(ArrayConverter::class) val data: Array ) \ No newline at end of file diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/script/js/JavaScriptAgent.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/script/js/JavaScriptAgent.kt index 21dc61d2..fd0e32c3 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/script/js/JavaScriptAgent.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/script/js/JavaScriptAgent.kt @@ -21,7 +21,7 @@ import javax.script.SimpleScriptContext * @author ItsFlicker * @since 2021/8/27 16:10 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object JavaScriptAgent { private val prefixes = arrayOf( diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/script/kether/KetherActions.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/script/kether/KetherActions.kt index 47d5c919..415d4b4a 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/script/kether/KetherActions.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/module/internal/script/kether/KetherActions.kt @@ -9,7 +9,7 @@ import taboolib.common.platform.Platform import taboolib.common.platform.PlatformSide import taboolib.module.kether.* -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) internal object KetherActions { @KetherParser(["channel"], namespace = "trchat", shared = true) diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/PAPIUtil.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/PAPIUtil.kt index c776dfbe..9f40533e 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/PAPIUtil.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/PAPIUtil.kt @@ -1,11 +1,9 @@ package me.arasple.mc.trchat.util import me.clip.placeholderapi.PlaceholderAPI -import me.clip.placeholderapi.PlaceholderAPIPlugin import org.bukkit.command.CommandSender import taboolib.common.platform.Platform import taboolib.common.platform.PlatformSide -import taboolib.common.platform.function.submit import taboolib.module.configuration.ConfigNode import taboolib.platform.util.sendLang @@ -13,7 +11,7 @@ import taboolib.platform.util.sendLang * @author Arasple * @date 2019/11/29 21:29 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object PAPIUtil { @ConfigNode("Options.Depend-Expansions", "settings.yml") @@ -32,40 +30,4 @@ object PAPIUtil { } } - /** - * 下载 PlaceholderAPI 拓展变量并注册 - * - * @param expansions 拓展 - */ - @Deprecated("works badly") - fun downloadExpansions(expansions: List) { - kotlin.runCatching { - if (expansions.isNotEmpty()) { - if (PlaceholderAPIPlugin.getInstance().cloudExpansionManager.cloudExpansions.isEmpty()) { - PlaceholderAPIPlugin.getInstance().cloudExpansionManager.fetch(false) - } - val unInstalled = expansions.filter { d -> - PlaceholderAPIPlugin.getInstance().localExpansionManager.expansions.none { e -> e.name.equals(d, ignoreCase = true) } - && PlaceholderAPIPlugin.getInstance().cloudExpansionManager.findCloudExpansionByName(d).isPresent - && !PlaceholderAPIPlugin.getInstance().cloudExpansionManager.isDownloading( - PlaceholderAPIPlugin.getInstance().cloudExpansionManager.findCloudExpansionByName(d).get() - ) - } - if (unInstalled.isNotEmpty()) { - unInstalled.forEach { ex -> - val cloudExpansion = PlaceholderAPIPlugin.getInstance().cloudExpansionManager.cloudExpansions[ex]!! - PlaceholderAPIPlugin.getInstance().cloudExpansionManager.downloadExpansion(cloudExpansion, cloudExpansion.version) - } - submit(delay = 20) { - PlaceholderAPIPlugin.getInstance().localExpansionManager.expansions.forEach { - PlaceholderAPIPlugin.getInstance().localExpansionManager.register(it) - } - } - } - } - }.onFailure { - it.print("PlaceholderAPI expansion(s) $expansions installed failed!Please install manually.") - } - } - } \ No newline at end of file diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/color/Hex.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/color/Hex.kt index 468fc652..000fc815 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/color/Hex.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/color/Hex.kt @@ -14,7 +14,7 @@ import kotlin.math.* * @author Esophose * converted from https://github.com/Rosewood-Development/RoseGarden/blob/master/src/main/java/dev/rosewood/rosegarden/utils/HexUtils.java */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object Hex { private const val CHARS_UNTIL_LOOP = 30 @@ -252,7 +252,7 @@ object Hex { if (MinecraftVersion.isHigherOrEqual(MinecraftVersion.V1_16)) return ChatColor.of(color).toString() var minDist = Int.MAX_VALUE var legacy = ChatColor.WHITE - for (mapping in ChatColorHexMapping.entries) { + for (mapping in ChatColorHexMapping.values()) { val r = mapping.red - color.red val g = mapping.green - color.green val b = mapping.blue - color.blue diff --git a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/color/MessageColors.kt b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/color/MessageColors.kt index da79cee8..b4b8fd11 100644 --- a/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/color/MessageColors.kt +++ b/project/runtime-bukkit/src/main/kotlin/me/arasple/mc/trchat/util/color/MessageColors.kt @@ -8,7 +8,7 @@ import taboolib.common.platform.PlatformSide * @author Arasple * @date 2019/8/15 20:52 */ -@PlatformSide([Platform.BUKKIT]) +@PlatformSide(Platform.BUKKIT) object MessageColors { const val COLOR_PERMISSION_NODE = "trchat.color." diff --git a/project/runtime-bungee/build.gradle.kts b/project/runtime-bungee/build.gradle.kts index 0746d86e..c70f0b1a 100644 --- a/project/runtime-bungee/build.gradle.kts +++ b/project/runtime-bungee/build.gradle.kts @@ -1,28 +1,6 @@ -val taboolib_version: String by project - -plugins { - id("io.izzel.taboolib") version "1.56" -} - dependencies { compileOnly(project(":project:common")) compileOnly("net.md-5:bungeecord-api:1.20-R0.1-SNAPSHOT") } -taboolib { - description { - name(rootProject.name) - desc("Advanced Minecraft Chat Control") - links { - name("homepage").url("https://trchat.trixey.cc/") - } - contributors { - name("Arasple") - name("ItsFlicker") - } - } - install("common", "platform-bungee") - options("skip-minimize", "keep-kotlin-module", "skip-taboolib-relocate") - classifier = null - version = taboolib_version -} \ No newline at end of file +taboolib { subproject = true } \ No newline at end of file diff --git a/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/api/impl/BungeeChannelManager.kt b/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/api/impl/BungeeChannelManager.kt index a62c9146..ae73d65d 100644 --- a/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/api/impl/BungeeChannelManager.kt +++ b/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/api/impl/BungeeChannelManager.kt @@ -21,7 +21,7 @@ import kotlin.system.measureTimeMillis * @author ItsFlicker * @since 2022/6/19 20:26 */ -@PlatformSide([Platform.BUNGEE]) +@PlatformSide(Platform.BUNGEE) object BungeeChannelManager : ChannelManager { init { diff --git a/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/api/impl/BungeeComponentManager.kt b/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/api/impl/BungeeComponentManager.kt index 2038e391..b30b0f51 100644 --- a/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/api/impl/BungeeComponentManager.kt +++ b/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/api/impl/BungeeComponentManager.kt @@ -12,7 +12,7 @@ import taboolib.module.chat.Components import taboolib.module.chat.impl.DefaultComponent import java.util.* -@PlatformSide([Platform.BUNGEE]) +@PlatformSide(Platform.BUNGEE) object BungeeComponentManager : ComponentManager { init { diff --git a/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/api/impl/BungeeProxyManager.kt b/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/api/impl/BungeeProxyManager.kt index a346a5f9..22ebe7d6 100644 --- a/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/api/impl/BungeeProxyManager.kt +++ b/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/api/impl/BungeeProxyManager.kt @@ -23,7 +23,7 @@ import java.util.concurrent.Future * @author ItsFlicker * @since 2022/6/18 19:21 */ -@PlatformSide([Platform.BUNGEE]) +@PlatformSide(Platform.BUNGEE) object BungeeProxyManager : ProxyMessageManager { init { diff --git a/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/module/internal/TrChatBungee.kt b/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/module/internal/TrChatBungee.kt index 87a71404..ff909ef7 100644 --- a/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/module/internal/TrChatBungee.kt +++ b/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/module/internal/TrChatBungee.kt @@ -18,7 +18,7 @@ import taboolib.module.lang.sendLang * @author Arasple * @date 2019/8/4 22:42 */ -@PlatformSide([Platform.BUNGEE]) +@PlatformSide(Platform.BUNGEE) object TrChatBungee : Plugin() { const val TRCHAT_CHANNEL = "trchat:main" diff --git a/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerBungeeTransfer.kt b/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerBungeeTransfer.kt index 80a1867a..c0271466 100644 --- a/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerBungeeTransfer.kt +++ b/project/runtime-bungee/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerBungeeTransfer.kt @@ -24,7 +24,7 @@ import java.io.IOException * @author ItsFlicker * @since 2021/8/9 15:01 */ -@PlatformSide([Platform.BUNGEE]) +@PlatformSide(Platform.BUNGEE) object ListenerBungeeTransfer { @SubscribeEvent(level = 0) diff --git a/project/runtime-velocity/build.gradle.kts b/project/runtime-velocity/build.gradle.kts index fb791c9e..15a37350 100644 --- a/project/runtime-velocity/build.gradle.kts +++ b/project/runtime-velocity/build.gradle.kts @@ -1,28 +1,11 @@ -val taboolib_version: String by project - -plugins { - id("io.izzel.taboolib") version "1.56" -} - dependencies { compileOnly(project(":project:common")) - compileOnly("com.velocitypowered:velocity-api:3.1.1") + compileOnly("com.velocitypowered:velocity-api:3.3.0-SNAPSHOT") +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } -taboolib { - description { - name(rootProject.name) - desc("Advanced Minecraft Chat Control") - links { - name("homepage").url("https://trchat.trixey.cc/") - } - contributors { - name("Arasple") - name("ItsFlicker") - } - } - install("common", "platform-velocity") - options("skip-minimize", "keep-kotlin-module", "skip-taboolib-relocate") - classifier = null - version = taboolib_version -} \ No newline at end of file +taboolib { subproject = true } \ No newline at end of file diff --git a/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/api/impl/VelocityChannelManager.kt b/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/api/impl/VelocityChannelManager.kt index 3a03fcad..81efb9b5 100644 --- a/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/api/impl/VelocityChannelManager.kt +++ b/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/api/impl/VelocityChannelManager.kt @@ -21,7 +21,7 @@ import kotlin.system.measureTimeMillis * @author ItsFlicker * @since 2022/6/19 20:26 */ -@PlatformSide([Platform.VELOCITY]) +@PlatformSide(Platform.VELOCITY) object VelocityChannelManager : ChannelManager { init { diff --git a/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/api/impl/VelocityProxyManager.kt b/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/api/impl/VelocityProxyManager.kt index c9a305c3..a9891d10 100644 --- a/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/api/impl/VelocityProxyManager.kt +++ b/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/api/impl/VelocityProxyManager.kt @@ -23,7 +23,7 @@ import java.util.concurrent.Future * @author ItsFlicker * @since 2022/6/18 19:21 */ -@PlatformSide([Platform.VELOCITY]) +@PlatformSide(Platform.VELOCITY) object VelocityProxyManager : ProxyMessageManager { val incoming: MinecraftChannelIdentifier diff --git a/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/module/internal/TrChatVelocity.kt b/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/module/internal/TrChatVelocity.kt index 29fe136f..188b3cc4 100644 --- a/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/module/internal/TrChatVelocity.kt +++ b/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/module/internal/TrChatVelocity.kt @@ -8,7 +8,6 @@ import taboolib.common.platform.Plugin import taboolib.common.platform.ProxyCommandSender import taboolib.common.platform.command.command import taboolib.common.platform.command.suggest -import taboolib.common.platform.function.console import taboolib.common.platform.function.pluginVersion import taboolib.common.util.unsafeLazy import taboolib.module.lang.sendLang @@ -21,14 +20,14 @@ import taboolib.platform.VelocityPlugin * @author ItsFlicker * @since 2021/8/21 13:42 */ -@PlatformSide([Platform.VELOCITY]) +@PlatformSide(Platform.VELOCITY) object TrChatVelocity : Plugin() { val plugin by unsafeLazy { VelocityPlugin.getInstance() } override fun onLoad() { - console().sendLang("Plugin-Loading", plugin.server.version.version) - console().sendLang("Plugin-Proxy-Supported", "Velocity") + VelocityConsole().sendLang("Plugin-Loading", plugin.server.version.version) + VelocityConsole().sendLang("Plugin-Proxy-Supported", "Velocity") } override fun onEnable() { @@ -44,8 +43,8 @@ object TrChatVelocity : Plugin() { } } } - VelocityChannelManager.loadChannels(console()) - console().sendLang("Plugin-Enabled", pluginVersion) + VelocityChannelManager.loadChannels(VelocityConsole()) + VelocityConsole().sendLang("Plugin-Enabled", pluginVersion) } } \ No newline at end of file diff --git a/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/module/internal/VelocityConsole.kt b/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/module/internal/VelocityConsole.kt new file mode 100644 index 00000000..b33a00cb --- /dev/null +++ b/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/module/internal/VelocityConsole.kt @@ -0,0 +1,41 @@ +package me.arasple.mc.trchat.module.internal + +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer +import taboolib.common.platform.ProxyCommandSender +import taboolib.platform.VelocityPlugin + +class VelocityConsole : ProxyCommandSender { + + private val sender = TrChatVelocity.plugin.server.consoleCommandSource + + override val origin: Any + get() = sender + + override val name: String + get() = "console" + + override var isOp: Boolean + get() = error("unsupported") + set(_) { + error("unsupported") + } + + override fun isOnline(): Boolean { + return true + } + + // TrPlugins/TrChat#350 + override fun sendMessage(message: String) { + sender.sendMessage(LegacyComponentSerializer.legacySection().deserialize(message)) + } + + override fun performCommand(command: String): Boolean { + VelocityPlugin.getInstance().server.commandManager.executeAsync(sender, command) + return true + } + + override fun hasPermission(permission: String): Boolean { + return sender.hasPermission(permission) + } + +} \ No newline at end of file diff --git a/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerVelocityTransfer.kt b/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerVelocityTransfer.kt index a7b29b02..d0dd91ec 100644 --- a/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerVelocityTransfer.kt +++ b/project/runtime-velocity/src/main/kotlin/me/arasple/mc/trchat/module/internal/listener/ListenerVelocityTransfer.kt @@ -23,7 +23,7 @@ import java.io.IOException * @author ItsFlicker * @since 2021/8/21 13:29 */ -@PlatformSide([Platform.VELOCITY]) +@PlatformSide(Platform.VELOCITY) object ListenerVelocityTransfer { @SubscribeEvent diff --git a/project/runtime-velocity/src/main/kotlin/taboolib/common/platform/Plugin.kt b/project/runtime-velocity/src/main/kotlin/taboolib/common/platform/Plugin.kt new file mode 100644 index 00000000..0bb1f573 --- /dev/null +++ b/project/runtime-velocity/src/main/kotlin/taboolib/common/platform/Plugin.kt @@ -0,0 +1,47 @@ +package taboolib.common.platform + +import java.io.File + +/** + * TabooLib + * taboolib.plugin.Plugin + * + * @author sky + * @since 2021/6/15 6:19 下午 + */ +abstract class Plugin { + + /** + * 当加载插件时调用 + */ + open fun onLoad() = Unit + + /** + * 当启用插件时调用 + */ + open fun onEnable() = Unit + + /** + * 当服务器启动完成时调用 + */ + open fun onActive() = Unit + + /** + * 当卸载插件时调用 + */ + open fun onDisable() = Unit + + /** + * 重定向插件文件(用于改变 TabooLib 逻辑) + */ + open fun nativeJarFile(): File? { + return null + } + + /** + * 重定向插件目录(用于改变 TabooLib 逻辑) + */ + open fun nativeDataFolder(): File? { + return null + } +} \ No newline at end of file diff --git a/project/runtime-velocity/src/main/resources/velocity-plugin.json b/project/runtime-velocity/src/main/resources/velocity-plugin.json new file mode 100644 index 00000000..5e9a0548 --- /dev/null +++ b/project/runtime-velocity/src/main/resources/velocity-plugin.json @@ -0,0 +1,10 @@ +{ + "id": "trchat", + "name": "TrChat", + "main": "me.arasple.mc.trchat.taboolib.platform.VelocityPlugin", + "version": "2.0.12", + "authors": [ + "Arasple", + "ItsFlicker" + ] +} \ No newline at end of file