From 4aededff46e47d71b9b2be47840f2edefa90d6f0 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 4 Feb 2019 19:57:01 -0800 Subject: [PATCH] allow prefix and non prefix control at the same time --- src/api/java/baritone/api/Settings.java | 2 +- .../baritone/utils/ExampleBaritoneControl.java | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index fd1d9ab85..508af1cc5 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -481,7 +481,7 @@ public final class Settings { /** * Whether or not to use the "#" command prefix */ - public final Setting prefix = new Setting<>(false); + public final Setting prefixControl = new Setting<>(true); /** * Don't stop walking forward when you need to break blocks in your way diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 1c710bdee..cca2bf3ac 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -87,22 +87,22 @@ public class ExampleBaritoneControl extends Behavior implements Helper { @Override public void onSendChatMessage(ChatEvent event) { - if (!Baritone.settings().chatControl.get() && !Baritone.settings().removePrefix.get()) { - return; - } String msg = event.getMessage(); - if (Baritone.settings().prefix.get()) { + if (Baritone.settings().prefixControl.get()) { if (msg.startsWith(COMMAND_PREFIX)) { if (!runCommand(msg.substring(COMMAND_PREFIX.length()))) { logDirect("Invalid command"); } - event.cancel(); // always cancel if using prefix - } - } else { - if (runCommand(msg)) { - event.cancel(); + event.cancel(); // always cancel if using prefixControl + return; } } + if (!Baritone.settings().chatControl.get() && !Baritone.settings().removePrefix.get()) { + return; + } + if (runCommand(msg)) { + event.cancel(); + } } public boolean runCommand(String msg0) { // you may think this can be private, but impcat calls it from .b =)