Sandertv / mcwss

A websocket server for Minecraft Bedrock Edition
https://godoc.org/github.com/Sandertv/mcwss
MIT License
114 stars 25 forks source link

OnPlayerMessage ignores repeated messages #1

Closed Tsubashi closed 4 years ago

Tsubashi commented 4 years ago

OnPlayerMessage ignores messages that are repeated. According to the comments, this is a workaround for the fact that this event fires both when sending a message, and when receiving that message. Unfortunately, this will also suppress new messages that have the same text as the last message.

From my experiments, though, there doesn't seem to be a duplicate event. I am pretty new to bedrock edition, though, so this might have been an issue in previous versions.

I am experimenting with creating custom commands via messages and I want to be able to run the same command over and over. The way this functions currently, that is not possible.

If this workaround is still necessary, I propose either clearing player.lastReceivedMessage once we see it, or adding an additional optional parameter which would disable the workaround altogether and leave it up to the client to handle the duplication.

Sandertv commented 4 years ago

Thank you for the report. It was, like you said, a workaround for a previous version, and it might very well already been fixed. If you don't mind, would you be able to open a PR to fix it in whichever way you think is best? (If the repetition is no longer present, removing it is fine)

Tsubashi commented 4 years ago

As far as I can tell, BDS 1.12.1 doesn't duplicate these events anymore, so I opted to remove it. I don't know if you want to add something to the documentation about it, or just leave it to the implementor to figure out. I don't know how many people are going to be using this on older servers anyway.

Sandertv commented 4 years ago

Thank you!