KubeJS-Mods / KubeJS

https://kubejs.com
GNU Lesser General Public License v3.0
307 stars 90 forks source link

Cannot modify player chat message on server, event is wrong type #828

Open PrincessRTFM opened 5 months ago

PrincessRTFM commented 5 months ago

Minecraft Version

1.20.1

KubeJS Version

2001.6.5-build.7

Rhino Version

2001.2.2-build.18

Architectury Version

9.2.14

Forge/Fabric Version

Forge 47.2.21

Describe your issue

ProbeJS says that the ServerEvents.chat event type should be Internal.PlayerChatDecorateEventJS, and looking through the code shows a PlayerChatDecorateEventJS.java file, but attempting to set the message property of the event or invoke the setMessage() method fails. The server.log file indicates that the property/method cannot be found on the type dev.latvian.mods.kubejs.player.PlayerChatReceivedEventJS, which a quick check of the relevant file shows is accurate.

Strangely, checking the PlayerEvents binding file shows that this should use the expected PlayerChatDecorateEventJS event. Using the ServerEvents.decorateChat handler instead does work as expected, providing the correct event type.

Crash report/logs

No response