Add ClientChatReceivedEvent for system messages (#9284)

This commit is contained in:
coehlrich authored and GitHub committed 2023-01-10 13:45:04 -08:00
1 parent 5946356f8e
commit 59ab01a559
4 files changed
+53

No files matched your search

@@ -118,4 +118,33 @@ public class ClientChatReceivedEvent extends Event
return this.playerChatMessage;
}
}
/**
* Fired when a system chat message is received on the client.
*
* <p>This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
* If the event is cancelled, the message is not displayed in the chat message window or in the overlay.</p>
*
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
*/
public static class System extends ClientChatReceivedEvent
{
private final boolean overlay;
@ApiStatus.Internal
public System(ChatType.Bound boundChatType, Component message, boolean overlay)
{
super(boundChatType, message, Util.NIL_UUID);
this.overlay = overlay;
}
/**
* {@return whether the message goes to the overlay}
*/
public boolean isOverlay()
{
return this.overlay;
}
}
}