Skip to content

Commit

Permalink
allow prefix and non prefix control at the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
leijurv committed Feb 5, 2019
1 parent ed8f986 commit 4aededf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/baritone/utils/ExampleBaritoneControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,22 @@ public ExampleBaritoneControl(Baritone baritone) {

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

0 comments on commit 4aededf

Please sign in to comment.