Fix chat format for team placeholder

This commit is contained in:
2025-07-27 00:56:12 -07:00
parent a0cacd64f1
commit 014106c3fe
2 changed files with 6 additions and 3 deletions

View File

@@ -9,7 +9,6 @@ pluginManagement {
} }
plugins { plugins {
id("org.sayandev.stickynote.settings") version "1.9.1.10" id("org.sayandev.stickynote.settings") version "1.10.4.41"}
}
rootProject.name = "GalaxyBoxPvP" rootProject.name = "GalaxyBoxPvP"

View File

@@ -4,9 +4,13 @@ package xyz.lncvrt.galaxyboxpvp
import com.booksaw.betterTeams.Team import com.booksaw.betterTeams.Team
import me.clip.placeholderapi.expansion.PlaceholderExpansion import me.clip.placeholderapi.expansion.PlaceholderExpansion
import net.kyori.adventure.text.minimessage.MiniMessage
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
import org.bukkit.ChatColor import org.bukkit.ChatColor
import org.bukkit.Statistic import org.bukkit.Statistic
import org.bukkit.entity.Player import org.bukkit.entity.Player
import org.sayandev.stickynote.bukkit.utils.AdventureUtils.legacyColored
import org.sayandev.stickynote.bukkit.utils.AdventureUtils.legacyString
import javax.annotation.Nullable import javax.annotation.Nullable
class PlaceholderAPIExpansion : PlaceholderExpansion() { class PlaceholderAPIExpansion : PlaceholderExpansion() {
@@ -44,7 +48,7 @@ class PlaceholderAPIExpansion : PlaceholderExpansion() {
"team" -> { "team" -> {
val team1: Team? = Team.getTeam(player) val team1: Team? = Team.getTeam(player)
if (team1 == null) return "" if (team1 == null) return ""
return "%s[%s%s%s%s]%s ".format(ChatColor.GRAY, ChatColor.RESET, team1.displayName, ChatColor.RESET, ChatColor.GRAY, ChatColor.RESET) return LegacyComponentSerializer.legacyAmpersand().serialize(MiniMessage.miniMessage().deserialize("<gray>[</gray>%s<gray>]</gray>".format(team1.displayName)))
} }
"teamname" -> { "teamname" -> {
val team2: Team? = Team.getTeam(player) val team2: Team? = Team.getTeam(player)