Title
com.jsmacrosce.jsmacros.client.api.event.impl.EventTitle
Fires when the client receives a title, subtitle, or action-bar message; type identifies the HUD line. Action-bar messages include client-side system messages. Listeners can replace message, assign null, or cancel the event to suppress the message.
js
JsMacros.on("Title", JavaWrapper.methodToJava(function (event) {
if (event.message === null) {
return;
}
if (event.type === "ACTIONBAR") {
if (event.message.getString().includes("moved too quickly")) {
// hide the lag message, the game shows nothing in its place
event.cancel();
return;
}
}
if (event.type === "TITLE") {
// keep the line but put something else in it
event.message = Chat.createTextHelperFromString("hello");
}
}))Constructors
new EventTitle
Initializes this event with a HUD line identifier and its supplied component; this does not dispatch or display the event. The identifier is stored verbatim and is not checked against
TITLE, SUBTITLE, or ACTIONBAR. The component is wrapped by TextHelper.wrap(Component) without cloning it; a null component produces a null helper.Parameters:
type: supplied HUD line identifier, conventionallyTITLE,SUBTITLE, orACTIONBARmessage: supplied component, ornull
Fields
message
message: TextHelper#Message to display, wrapped in a TextHelper; assigning a replacement changes the displayed text.
null or cancelling passes no component to the game. For action-bar messages, the usual display timer is still reset when suppressed.type
Methods
toString
Returns a diagnostic string containing the event name, type, and current message helper's string representation. The format is
%s:{"type": "%s", "message": "%s"}; it is not JSON serialization, and values are not escaped. A null current message is represented as the literal null inside the quoted message field.Returns: diagnostic text with the event name, type, and current message helper representation