From 0fcc68c7a2f46153f858a759a789a75a3a92d174 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+chomens@users.noreply.github.com> Date: Sat, 2 Nov 2024 15:06:43 +0700 Subject: [PATCH] fix: commandspy on non-chipmunk servers --- .../chipmunk/chipmunkbot/plugins/CommandSpyPlugin.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/land/chipmunk/chipmunkbot/plugins/CommandSpyPlugin.java b/src/main/java/land/chipmunk/chipmunkbot/plugins/CommandSpyPlugin.java index f68355a..8338909 100644 --- a/src/main/java/land/chipmunk/chipmunkbot/plugins/CommandSpyPlugin.java +++ b/src/main/java/land/chipmunk/chipmunkbot/plugins/CommandSpyPlugin.java @@ -19,12 +19,14 @@ public class CommandSpyPlugin extends ChatPlugin.Listener { private static final Style ENABLED_STYLE = Style.style(NamedTextColor.YELLOW); private static final Style DISABLED_STYLE = Style.style(NamedTextColor.AQUA); - private static final Component COMMANDSPY_ENABLED_COMPONENT = Component + private static final Component COMMANDSPY_ENABLED_COMPONENT = Component.text("Successfully enabled CommandSpy"); + private static final Component COMMANDSPY_DISABLED_COMPONENT = Component.text("Successfully disabled CommandSpy"); + private static final Component COMMANDSPY_ENABLED_COMPONENT_CHIPMUNK = Component .empty() .append(Component.text("Successfully ")) .append(Component.text("enabled")) .append(Component.text(" CommandSpy")); - private static final Component COMMANDSPY_DISABLED_COMPONENT = Component + private static final Component COMMANDSPY_DISABLED_COMPONENT_CHIPMUNK = Component .empty() .append(Component.text("Successfully ")) .append(Component.text("disabled")) @@ -42,8 +44,8 @@ public class CommandSpyPlugin extends ChatPlugin.Listener { public void systemMessageReceived (Component component, boolean overlay) { if (overlay || !(component instanceof final TextComponent t_component)) return; - if (component.equals(COMMANDSPY_ENABLED_COMPONENT)) { this.enabled = true; return; } - if (component.equals(COMMANDSPY_DISABLED_COMPONENT)) { this.enabled = false; return; } + if (component.equals(COMMANDSPY_ENABLED_COMPONENT) || component.equals(COMMANDSPY_ENABLED_COMPONENT_CHIPMUNK)) { this.enabled = true; return; } + if (component.equals(COMMANDSPY_DISABLED_COMPONENT) || component.equals(COMMANDSPY_DISABLED_COMPONENT_CHIPMUNK)) { this.enabled = false; return; } final boolean enabled = component.style().equals(ENABLED_STYLE); if (!enabled && !component.style().equals(DISABLED_STYLE)) return;