Use components instead of ChatColor in more places (#12507)

This commit is contained in:
Epic
2025-05-02 01:11:25 +01:00
committed by GitHub
parent 1acf3b3837
commit b9b3cd652e
5 changed files with 29 additions and 25 deletions

View File

@@ -10,9 +10,10 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import com.mojang.brigadier.tree.LiteralCommandNode;
import io.papermc.paper.command.brigadier.CommandSourceStack;
import java.util.ArrayList;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.minecraft.commands.CommandSource;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandException;
@@ -107,7 +108,7 @@ public class BukkitCommandNode extends LiteralCommandNode<CommandSourceStack> {
try {
results = this.command.tabComplete(sender, this.literal, args, pos.clone());
} catch (CommandException ex) {
sender.sendMessage(ChatColor.RED + "An internal error occurred while attempting to tab-complete this command");
sender.sendMessage(Component.text("An internal error occurred while attempting to tab-complete this command", NamedTextColor.RED));
Bukkit.getServer().getLogger().log(Level.SEVERE, "Exception when " + sender.getName() + " attempted to tab complete " + builder.getRemaining(), ex);
}