allow prefix and non prefix control at the same time

This commit is contained in:
Leijurv 2019-02-04 19:57:01 -08:00
parent ed8f9863e3
commit 4aededff46
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 10 additions and 10 deletions

View File

@ -481,7 +481,7 @@ public final class Settings {
/**
* Whether or not to use the "#" command prefix
*/
public final Setting<Boolean> prefix = new Setting<>(false);
public final Setting<Boolean> prefixControl = new Setting<>(true);
/**
* Don't stop walking forward when you need to break blocks in your way

View File

@ -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 =)