Skip to content

Commit

Permalink
[6.0.10] update chat system & nms api
Browse files Browse the repository at this point in the history
  • Loading branch information
Bkm016 committed Feb 9, 2023
1 parent 2474a83 commit e355bd4
Show file tree
Hide file tree
Showing 55 changed files with 1,397 additions and 725 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package taboolib.common.env;

import sun.misc.Unsafe;
import taboolib.common.classloader.IsolatedClassLoader;
import taboolib.common.TabooLibCommon;
import taboolib.common.classloader.IsolatedClassLoader;

import java.io.File;
import java.lang.invoke.MethodHandle;
Expand Down
23 changes: 22 additions & 1 deletion common/src/main/kotlin/taboolib/common/util/VariableReader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,28 @@ class VariableReader(val start: String = "{{", val end: String = "}}") {
}

private fun format(str: String): String {
return str.replace("\\$start", start).replace("\\$end", end)
// 不使用 replace 将 "\" + start 和 "\" + end 替换为 start" 和 end
return buildString {
var i = 0
while (i < str.length) {
if (str[i] == '\\') {
// 完整匹配 start 和 end
if (i + start.length < str.length && str.substring(i + 1, i + start.length + 1) == start) {
append(start)
i += start.length + 1
} else if (i + end.length < str.length && str.substring(i + 1, i + end.length + 1) == end) {
append(end)
i += end.length + 1
} else {
append(str[i])
i++
}
} else {
append(str[i])
i++
}
}
}
}

private fun indexOf(source: String, str: String, start: Int = 0): Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package taboolib.expansion.ioc.database.impl
import taboolib.common.platform.function.getDataFolder
import taboolib.expansion.ioc.database.IOCDatabase
import taboolib.expansion.ioc.serialization.SerializationManager
import taboolib.module.configuration.*
import taboolib.module.configuration.Configuration
import taboolib.module.configuration.Type
import taboolib.module.configuration.createLocal
import java.io.File
import java.util.concurrent.ConcurrentHashMap

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package taboolib.expansion.ioc.database.impl

import com.google.gson.GsonBuilder
import com.google.gson.JsonDeserializer
import com.google.gson.JsonPrimitive
import com.google.gson.JsonSerializer
import org.bukkit.Material
import org.bukkit.util.Vector
import taboolib.expansion.ioc.database.IOCDatabase
import taboolib.expansion.ioc.serialization.SerializationManager
import taboolib.library.xseries.parseToMaterial
import taboolib.module.configuration.*
import taboolib.module.configuration.Configuration
import taboolib.module.configuration.Type
import taboolib.module.configuration.createLocal

open class IOCDatabaseYaml : IOCDatabase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package taboolib.expansion.ioc.linker

import taboolib.expansion.ioc.IOCReader
import taboolib.expansion.ioc.IndexReader
import taboolib.expansion.ioc.database.IOCDatabase
import taboolib.expansion.ioc.database.impl.IOCDatabaseYaml
import java.util.*
import java.util.concurrent.ConcurrentHashMap
Expand Down
23 changes: 11 additions & 12 deletions module/module-chat/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

dependencies {
compileOnly("com.google.code.gson:gson:2.8.7")
compileOnly("net.md-5:bungeecord-chat:1.17")
compileOnly(project(":common"))
}

//tasks {
// withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
// archiveClassifier.set("")
// archiveBaseName.set("${archiveBaseName.get()}-compileOnly")
// dependencies {
// include(dependency("net.md-5:bungeecord-chat:1.17"))
// }
// }
// build {
// dependsOn(shadowJar)
// }
//}
tasks {
withType<ShadowJar> {
archiveClassifier.set("")
relocate("net.md_5.bungee", "net.md_5.bungee117")
}
build {
dependsOn(shadowJar)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static String translate(String in) {
} catch (IllegalArgumentException ignored) {
}
} else {
Optional<KnownColor> knownColor = KnownColor.matchKnownColor(toString(match));
Optional<StandardColors> knownColor = StandardColors.match(toString(match));
if (knownColor.isPresent()) {
chatColor = knownColor.get().toChatColor();
}
Expand Down
Loading

0 comments on commit e355bd4

Please sign in to comment.