Skip to content

Commit

Permalink
[2.0.12] Experimental Update
Browse files Browse the repository at this point in the history
* Update taboolib to 6.1.0
* Fix bugs
  • Loading branch information
ItsFlicker committed Feb 4, 2024
1 parent 096b7e6 commit 6acd948
Show file tree
Hide file tree
Showing 72 changed files with 285 additions and 309 deletions.
68 changes: 18 additions & 50 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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<JavaPlugin>()
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/")
Expand All @@ -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
Expand All @@ -81,15 +58,6 @@ subprojects {
freeCompilerArgs = listOf("-Xjvm-default=all", "-Xextended-compiler-checks")
}
}
tasks.withType<ShadowJar> {
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 {
Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
54 changes: 29 additions & 25 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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<ShadowJar> {
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()
}
5 changes: 5 additions & 0 deletions project/common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dependencies {
compileOnly("com.eatthepath:fast-uuid:0.2.0")
}

taboolib { subproject = true }
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<FilterManager>(this)
}

Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ 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

/**
* @author ItsFlicker
* @since 2022/6/18 15:26
*/
@Awake
object DefaultTrChatAPI : TrChatAPI {

init {
@Awake(LifeCycle.CONST)
fun init() {
TrChat.register(this)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package me.arasple.mc.trchat.util

import taboolib.common.util.asList
import taboolib.library.configuration.Converter

class ArrayConverter : Converter<Array<String>, Any> {
override fun convertToField(value: Any): Array<String> {
return value.asList().toTypedArray()
}

override fun convertFromField(value: Array<String>): Any {
return if (value.size == 1) value[0] else value.toList()
}
}
14 changes: 1 addition & 13 deletions project/common/src/main/kotlin/me/arasple/mc/trchat/util/Util.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -47,14 +45,4 @@ fun buildMessage(vararg messages: String): List<ByteArray> {

fun String.toUUID(): UUID = FastUUID.parseUUID(this)

fun UUID.parseString(): String = FastUUID.toString(this)

class ArrayLikeConverter : Converter<Array<String>, Any> {
override fun convertToField(value: Any): Array<String> {
return value.asList().toTypedArray()
}

override fun convertFromField(value: Array<String>): Any {
return if (value.size == 1) value[0] else value.toList()
}
}
fun UUID.parseString(): String = FastUUID.toString(this)
4 changes: 3 additions & 1 deletion project/module-adventure/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ dependencies {
compileOnly(project(":project:common"))
compileOnly(project(":project:module-nms"))
compileOnly("net.kyori:adventure-platform-bukkit:4.3.2")
}
}

taboolib { subproject = true }
4 changes: 3 additions & 1 deletion project/module-nms/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

taboolib { subproject = true }
35 changes: 3 additions & 32 deletions project/runtime-bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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/")
}
Expand All @@ -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
}
taboolib { subproject = true }
Original file line number Diff line number Diff line change
Expand Up @@ -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<ChannelManager>(this)
}

Expand Down
Loading

0 comments on commit 6acd948

Please sign in to comment.