Skip to content

Commit

Permalink
.say & .clear addition (#100)
Browse files Browse the repository at this point in the history
* .clear: dont clear input history by default

* .say: add option to send message via localPlayer
  • Loading branch information
VADemon authored and fr1kin committed Jul 25, 2019
1 parent 5d0611a commit 947e43f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ public Command clearChat(CommandBuilders builders) {
.newCommandBuilder()
.name("clear")
.description("Clears chat")
.options(p -> p.acceptsAll(Arrays.asList("all", "a"), "Also clear sent message history"))
.processor(d -> MC.addScheduledTask(
() -> MC.ingameGUI.getChatGUI().clearChatMessages(true))
() -> MC.ingameGUI.getChatGUI().clearChatMessages(d.hasOption("all")))
)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public Command say(CommandBuilders builders) {
.options(
parser -> {
parser.acceptsAll(Arrays.asList("fake", "f"), "Send a fake message that won't be treated as command");
parser.acceptsAll(Arrays.asList("local", "l"), "Send message from local chat");
}
)
.processor(
Expand All @@ -36,7 +37,11 @@ public Command say(CommandBuilders builders) {
if (fake) {
msg = new StringBuilder().appendCodePoint(fakePrefix).append(msg).toString();
}
PacketHelper.ignoreAndSend(new CPacketChatMessage(msg));
if (data.hasOption("local")) {
getLocalPlayer().sendChatMessage(msg);
} else {
PacketHelper.ignoreAndSend(new CPacketChatMessage(msg));
}
}
}
)
Expand Down

0 comments on commit 947e43f

Please sign in to comment.