forked from chipmunkmc/chipmunkbot
fix: commandspy on non-chipmunk servers
This commit is contained in:
parent
22c736c67d
commit
0fcc68c7a2
1 changed files with 6 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue