SendMessage
com.jsmacrosce.jsmacros.client.api.event.impl.EventSendMessage
Fires for text submitted through the chat screen, before the game normalizes it. Cancelling prevents sending and chat-history insertion. A changed, nonempty value is sent directly without normalization or history insertion; null or an empty replacement is not sent. A leading / selects command submission, with the slash removed.
js
JsMacros.on("SendMessage", JavaWrapper.methodToJava(function (event) {
if (event.message === null) {
return;
}
if (event.message === "/hello") {
// swallow it, nothing is sent and nothing is added to the history
event.cancel();
return;
}
// rewrite it, the client sends this instead of what was typed
event.message = `say ${event.message}`;
}))