Chat event is not fired on advancement chat message
Nononitas opened this issue ยท 9 comments
Describe the bug
You can't listen to advacements messages on version 1.19 using v5 Build 569
On 1.18 it works like excepted, where you get an event fired for an advancement message
To Reproduce
- Register a listener for example like that https://pastebin.com/sFkLpWfw
- give yourself an advancement like: /advancement grant Nononitas only minecraft:adventure/ol_betsy
- You will see that the event wasn't fired
Expected behavior
That the PacketType.Play.Out.Server.CHAT event is fired
I suppose that the message is now send via SYSTEM_CHAT rather than the CHAT packet
I've got the same problem. I'm actually trying to fix it but I can't. I failed to find where the problem comes from
Ah I see
On SYSTEM_CHAT it tells me there is no ChatBaseComponent altough it's clearly there in the packet in content or isn't it?
https://pastebin.com/SfYDigyd
Ah I see On SYSTEM_CHAT it tells me there is no ChatBaseComponent altough it's clearly there in the packet in content or isn't it? https://pastebin.com/SfYDigyd
It seems to contains a Component object (that is from Kyori's API) and a string (which seems to be a json)
Ok, I can intercept it with SYSTEM_CHAT but I can't cancel the event. The output is basically ignored.
https://pastebin.com/FycUMAhV
I can try it out for myself later, but I'm pretty sure you can cancel packets (if I understand your problem correctly)
I can try it out for mysql later, but I'm pretty sure you can cancel packets (if I understand your problem correctly)
So?
Works for me, nothing is displayed in the client chat. My code:
var listener = new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.SYSTEM_CHAT) {
@Override
public void onPacketSending(PacketEvent event) {
log.warning("CANCELLING " + event.getPacket().getStrings().read(0));
event.setCancelled(true);
}
});
Output:
CANCELLING {"translate":"chat.type.advancement.task","with":[{"insertion":"derklaro","clickEvent":{"action":"suggest_command","value":"/tell derklaro "},"hoverEvent":{"action":"show_entity","contents":{"type":"minecraft:player","id":"bcc582ed-494d-4b93-86cb-b58564651a26","name":{"text":"derklaro"}}},"text":"derklaro"},{"color":"green","translate":"chat.square_brackets","with":[{"hoverEvent":{"action":"show_text","contents":{"color":"green","extra":[{"text":"\n"},{"translate":"advancements.story.mine_stone.description"}],"translate":"advancements.story.mine_stone.title"}},"translate":"advancements.story.mine_stone.title"}]}]}