ErdbeerbaerLP / DiscordIntegration-Forge

Forge version of the Discord Integration mod
https://modrinth.com/plugin/dcintegration
MIT License
99 stars 54 forks source link

[Bug]: Random Things Floo Network teleportation chats get put into Discord #555

Open Ricket opened 8 months ago

Ricket commented 8 months ago

What happened?

Random Things mod has Floo Teleportation that works like in Harry Potter: hold some floo powder, stand in a fireplace, say (in chat) the name of the destination you want to teleport to, and you will be sent there. The chat message doesn't get sent to other players. But, DiscordIntegration does sent the chat message to Discord. So players who are teleporting appear like they are spamming the chat with the teleport destination names.

Game Version

1.12

What platform are you using?

Forge

Platform version

14.23.5.2855

Config File

n/a

Crash report / Error log (if applicable)

No response

Additional Information

No response

Ricket commented 8 months ago

See attached PR for the fix; I tested it in my server with Random Things RandomThings-MC1.12.2-4.2.7.4.jar .

You can see here that Random Things handles ServerChatEvent and, if the player is standing in a fireplace and says a valid teleport destination, then it calls event.setCanceled(true);

So by setting priority to lowest and checking the cancelled flag, Discord Integration can ignore the teleport chat message.