Cancel something in an event

How can I cancel something that the game itself does when something happens? When a player dies, how can I cancel the “Player fell from a high place” text that comes up in the chat?

Thank you.

https://github.com/SpongePowered/SpongeAPI/blob/stable-5.1.0/src/main/java/org/spongepowered/api/event/entity/DestructEntityEvent.java#L38

Specially noting that there is a Death subclass, and that it extends MessageChannelEvent

https://github.com/SpongePowered/SpongeAPI/blob/stable-5.1.0/src/main/java/org/spongepowered/api/event/message/MessageChannelEvent.java

let’s you change the channel, but it also extends MessageEvent

https://github.com/SpongePowered/SpongeAPI/blob/stable-5.1.0/src/main/java/org/spongepowered/api/event/message/MessageEvent.java#L85

setMessageCancelled(true) Is likely the method you are looking for, after you have verified that it applies to the player you want, or any other details.

1 Like

I will be studying this. Thank you for your awesome information.