Skip to content

Commit

Permalink
[2.2.0-beta6] DragonCore Color
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsFlicker committed Oct 20, 2024
1 parent a698c6e commit 82b31f7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ subprojects {
install(Bukkit, BungeeCord, Velocity)
}
version {
taboolib = "6.2.0-beta16"
taboolib = "6.2.0-beta20"
coroutines = null
// isSkipKotlin = true
// isSkipKotlinRelocate = true
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=me.arasple.mc.trchat
version=2.2.0-beta4
version=2.2.0-beta6
kotlin.incremental=true
kotlin.incremental.java=true
kotlin.incremental.useClasspathSnapshot=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import me.arasple.mc.trchat.module.display.function.Function
import me.arasple.mc.trchat.module.internal.hook.HookPlugin
import me.arasple.mc.trchat.module.internal.script.Condition
import me.arasple.mc.trchat.util.color.CustomColor
import me.arasple.mc.trchat.util.isDragonCoreHooked
import me.arasple.mc.trchat.util.pass
import me.arasple.mc.trchat.util.session
import net.md_5.bungee.api.chat.TextComponent
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import taboolib.common.util.VariableReader
import taboolib.module.chat.ComponentText
import taboolib.module.chat.Components
import taboolib.module.chat.impl.DefaultComponent

/**
* @author ItsFlicker
Expand Down Expand Up @@ -55,7 +58,11 @@ class MsgComponent(val defaultColor: List<Pair<CustomColor, Condition?>>, style:

override fun toTextComponent(sender: CommandSender, vararg vars: String): ComponentText {
val message = vars[0]
val component = Components.text(message)
val component = if (isDragonCoreHooked) {
Components.empty().append(DefaultComponent(listOf(TextComponent(message))))
} else {
Components.text(message)
}
style.forEach {
it.applyTo(component, sender, *vars)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package me.arasple.mc.trchat.module.display.format.obj

import me.arasple.mc.trchat.module.conf.file.Settings
import me.arasple.mc.trchat.module.internal.script.Condition
import me.arasple.mc.trchat.util.*
import me.arasple.mc.trchat.util.color.colorify
import me.arasple.mc.trchat.util.parseInline
import me.arasple.mc.trchat.util.parseSimple
import me.arasple.mc.trchat.util.pass
import me.arasple.mc.trchat.util.setPlaceholders
import net.md_5.bungee.api.chat.TextComponent
import org.bukkit.command.CommandSender
import taboolib.common.util.replaceWithOrder
import taboolib.module.chat.ComponentText
import taboolib.module.chat.impl.DefaultComponent

sealed interface Style {

Expand All @@ -36,7 +35,11 @@ sealed interface Style {
if (Settings.simpleHover) {
component.hoverText(content.parseSimple())
} else {
component.hoverText(content.colorify())
if (isDragonCoreHooked) {
component.hoverText(DefaultComponent(listOf(TextComponent(content.colorify()))))
} else {
component.hoverText(content.colorify())
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ class Text(val content: String, val condition: Condition?) {
}
text = HookPlugin.getItemsAdder().replaceFontImages(text, null)
}
text = text.replaceWithOrder(*vars).colorify()
return if (isDragonCoreHooked) {
// 使有效部分在latest
Components.empty().append(DefaultComponent(listOf(TextComponent(text.replaceWithOrder(*vars).colorify()))))
Components.empty().append(DefaultComponent(listOf(TextComponent(text))))
} else {
Components.text(text.replaceWithOrder(*vars).colorify())
Components.text(text)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import me.arasple.mc.trchat.module.internal.hook.type.HookDisplayItem
import me.arasple.mc.trchat.module.internal.script.Reaction
import me.arasple.mc.trchat.util.*
import net.kyori.adventure.translation.Translatable
import net.md_5.bungee.api.chat.TextComponent
import org.bukkit.Material
import org.bukkit.block.ShulkerBox
import org.bukkit.entity.Player
Expand Down Expand Up @@ -210,6 +211,9 @@ object ItemShow : Function("ITEM") {
// return itemMeta!!.displayName()!!.toNative()
// } catch (_: Throwable) {
// }
if (isDragonCoreHooked) {
return Components.empty().append(DefaultComponent(listOf(TextComponent(itemMeta!!.displayName))))
}
try {
// 使有效部分在latest
return Components.empty().append(DefaultComponent(itemMeta!!.displayNameComponent.toList()))
Expand Down

0 comments on commit 82b31f7

Please sign in to comment.