Solved Canceling ChatEvent causes kick "Chat message validation failure"

Bobcatsss

New member
Apr 6, 2023
1
0
1
I have a simple staff chat plugin that runs on the waterfall side and if a player has staff chat on it will cancel the ChatEvent and send all online people who have permission their messages, however, with 1.19.4 I have run into an issue where this now kicks the player when they toggle staff chat on, talk in staff chat and then toggle it back off and talk in chat they will be kicked.

I have confirmed the issue is canceling the ChatEvent but my question is what would be the best way to work around this for a cross server staff chat plugin since I can no longer cancel the event?

Quick video showing the issue

Code:

Java:
    @EventHandler
    public void onCommand(ChatEvent event) {
        if(!(event.getSender() instanceof ProxiedPlayer)) return;
        ProxiedPlayer player = (ProxiedPlayer)event.getSender();
        if(event.isCancelled()) return;
        if(event.isCommand()) return;
        if(data.hasStaffChatEnabled(player.getUniqueId())) {
            event.setCancelled(true);
            data.sendStaffChatMessage(player.getName(), event.getMessage());
        }
    }

Edit, pretty much answered on GitHub, don't cancel the event on the proxy side.
 
Last edited: