DOES THIW IJwrfioewu7584879

This commit is contained in:
Chayapak 2023-09-22 18:46:27 +07:00
parent d091ee4b43
commit 43dc5aa834
3 changed files with 14 additions and 2 deletions

View file

@ -106,7 +106,7 @@ public class ChatPlugin extends Bot.Listener {
final String ansi = ComponentUtilities.stringifyAnsi(component); final String ansi = ComponentUtilities.stringifyAnsi(component);
for (Listener listener : listeners) { for (Listener listener : listeners) {
if (!isCommandSuggestions && !isAuth && !isImposterFormat) listener.systemMessageReceived(component, string, ansi); if (!isCommandSuggestions && !isAuth) listener.systemMessageReceived(component, string, ansi);
listener.systemMessageReceived(component, isCommandSuggestions, isAuth, isImposterFormat, string, ansi); listener.systemMessageReceived(component, isCommandSuggestions, isAuth, isImposterFormat, string, ansi);
if (playerMessage != null) listener.playerMessageReceived(playerMessage); if (playerMessage != null) listener.playerMessageReceived(playerMessage);

View file

@ -1,5 +1,6 @@
package land.chipmunk.chayapak.chomens_bot.plugins; package land.chipmunk.chayapak.chomens_bot.plugins;
import com.github.steveice10.packetlib.event.session.ConnectedEvent;
import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.Bot;
import land.chipmunk.chayapak.chomens_bot.Configuration; import land.chipmunk.chayapak.chomens_bot.Configuration;
import land.chipmunk.chayapak.chomens_bot.Main; import land.chipmunk.chayapak.chomens_bot.Main;
@ -23,6 +24,8 @@ public class ConsolePlugin implements Completer {
public String prefix; public String prefix;
public Component formatPrefix;
private static final List<Listener> listeners = new ArrayList<>(); private static final List<Listener> listeners = new ArrayList<>();
public ConsolePlugin (List<Bot> allBots, Configuration discordConfig, JDA jda) { public ConsolePlugin (List<Bot> allBots, Configuration discordConfig, JDA jda) {
@ -39,6 +42,13 @@ public class ConsolePlugin implements Completer {
bot.console = this; bot.console = this;
bot.addListener(new Bot.Listener() {
@Override
public void connected(ConnectedEvent event) {
bot.console.formatPrefix = Component.text(bot.username + " Console").color(NamedTextColor.GRAY);
}
});
bot.logger = new LoggerPlugin(bot); bot.logger = new LoggerPlugin(bot);
} }
@ -104,7 +114,7 @@ public class ConsolePlugin implements Completer {
bot.chat.tellraw( bot.chat.tellraw(
Component.translatable( Component.translatable(
"[%s] %s %s", "[%s] %s %s",
Component.text(bot.username + " Console").color(NamedTextColor.GRAY), formatPrefix,
Component.text(bot.config.ownerName).color(ColorUtilities.getColorByString(bot.config.colorPalette.ownerName)), Component.text(bot.config.ownerName).color(ColorUtilities.getColorByString(bot.config.colorPalette.ownerName)),
Component.text(line).color(NamedTextColor.GRAY) Component.text(line).color(NamedTextColor.GRAY)
).color(NamedTextColor.DARK_GRAY) ).color(NamedTextColor.DARK_GRAY)

View file

@ -43,6 +43,8 @@ public class FormatCheckerPlugin extends ChatPlugin.Listener {
final Component prefix = format.args().get(0); final Component prefix = format.args().get(0);
if (prefix.equals(bot.console.formatPrefix)) return false;
if (!(prefix instanceof TranslatableComponent translatablePrefix)) return true; if (!(prefix instanceof TranslatableComponent translatablePrefix)) return true;
final Component userHash = translatablePrefix.args().get(0); final Component userHash = translatablePrefix.args().get(0);