make trusted broadcast not confusing in console

This commit is contained in:
Chayapak 2023-05-09 16:42:25 +07:00
parent 14d07a0643
commit 84a984f2f6

View file

@ -26,7 +26,14 @@ public class TrustedPlugin extends PlayersPlugin.Listener {
for (Bot bot : bot.bots()) {
if (!bot.loggedIn()) continue;
bot.logger().custom(Component.text("Trusted Broadcast").color(NamedTextColor.AQUA), message);
final Component component = Component.translatable(
"[%s] [%s] %s",
Component.text("ChomeNS Bot").color(NamedTextColor.YELLOW),
Component.text(this.bot.options().serverName()).color(NamedTextColor.GRAY),
message.color(NamedTextColor.WHITE)
).color(NamedTextColor.DARK_GRAY);
bot.logger().custom(Component.text("Trusted Broadcast").color(NamedTextColor.AQUA), component);
for (String player : list) {
final MutablePlayerListEntry entry = bot.players().getEntry(player);
@ -35,13 +42,6 @@ public class TrustedPlugin extends PlayersPlugin.Listener {
if (entry.profile().getId() == exceptTarget) continue;
final Component component = Component.translatable(
"[%s] [%s] %s",
Component.text("ChomeNS Bot").color(NamedTextColor.YELLOW),
Component.text(this.bot.options().serverName()).color(NamedTextColor.GRAY),
message.color(NamedTextColor.WHITE)
).color(NamedTextColor.DARK_GRAY);
bot.chat().tellraw(component, player);
}
}