kangarko / ChatControl-Pro

The ultimate chat solution. Prevent spam, ads, swears and even bots on your server. Replaced by ChatControl Red: https://mineacademy.org/chatcontrol-red
Other
65 stars 8 forks source link

1.16.5: How to cancel checking messages via the API #2267

Closed Kiteflow closed 3 years ago

Kiteflow commented 3 years ago

Hello, I'm currently using a custom chat plugin, and am wondering whether it's possible to cancel checking messages via the API? I'm currently checking them with the API, but for certain things (Advertisements) it's checking them twice.

Thanks

kangarko commented 3 years ago

Yes, there is PreRuleMatchEvent that is fired to check rules, you can listen to that and cancel it

Kiteflow commented 3 years ago

Sorry for reopening this but this also seems to cancel checking messages via the API. Is there a way to block the plugin checking them but also manually checking them?

kangarko commented 3 years ago

You can manually check the message using ChatControlAPI#checkMessage

Kiteflow commented 3 years ago

This also appears to fire the prerulematchevent though

kangarko commented 3 years ago

Yeah that's intended behavior.

Kiteflow commented 3 years ago

Is there anyway to stop it, as I am trying to only check messages via the API. Or is it impossible

kangarko commented 3 years ago

Not right now sorry, but you could set the player an invisible metadata and then ignore said event if the metadata are present.

kangarko commented 3 years ago

make sure to remove them right after the method