Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add event cancelling to chat messages #92

Closed
ErikDombi opened this issue Oct 27, 2020 · 9 comments · Fixed by #327
Closed

Add event cancelling to chat messages #92

ErikDombi opened this issue Oct 27, 2020 · 9 comments · Fixed by #327
Labels
api Stuff about the plugin api

Comments

@ErikDombi
Copy link

ErikDombi commented Oct 27, 2020

Api Suggestion

Suggestion

As the ability to cancel events with the API

Use case

For my particular use case, I want to be able to cancel message events starting with /

Expected result

Player Sends Message Starting With "/",
The Event Is Cancelled,
No player receives the message
(Message can still be sent with e.Game.SendToAsync())

@ErikDombi ErikDombi added the api Stuff about the plugin api label Oct 27, 2020
@AeonLucid AeonLucid changed the title Add event cancelling Add event cancelling to chat messages Oct 27, 2020
@ErikDombi
Copy link
Author

I don't think event cancelling should be limited to just chat events. Ideally all events would be cancellable.

@Mm2PL
Copy link
Contributor

Mm2PL commented Oct 27, 2020

Due to how events work, this should be doable on every type of event.

I think
  1. Receive packet from client
  2. Decode packet
  3. Fire off appropriate events
  4. Forward packet to other clients

The fourth step can be ignored if the event was canceled, and other players won't see the thing happen.
E: not exactly true

@ErikDombi
Copy link
Author

Could this lead to possible desync?

@Mm2PL
Copy link
Contributor

Mm2PL commented Oct 27, 2020

Could this lead to possible desync?

🤔 Probably on some events.

@AeonLucid
Copy link
Collaborator

AeonLucid commented Oct 27, 2020

@Mm2PL this will lead to desync, it will only work for specific type of events like chatting. For cancelling other events (such as venting) we would need to send the inverse of that event (going out of the vent). Because client's do not verify their action with the server before doing it.

@danbudworthmead
Copy link
Contributor

I've been messing around with blocking packets.
Here's an example of blocking chat packets beginning with "/"

danbudworthmead@e032c0d

@AeonLucid
Copy link
Collaborator

@danbudworthmead I won't be merging that if you PR it. Reason for that is that there can be another GameData message after the GameData event you are canceling. You are returning, effectively canceling everything in that stream.

@danbudworthmead
Copy link
Contributor

danbudworthmead commented Oct 29, 2020

@danbudworthmead I won't be merging that if you PR it. Reason for that is that there can be another GameData message after the GameData event you are canceling. You are returning, effectively canceling everything in that stream.

Aha dw not planning to PR. Just thought it might be useful in this thread if someone's looking to do something similar.

@stale
Copy link

stale bot commented Dec 28, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 28, 2020
@stale stale bot closed this as completed Jan 4, 2021
@AeonLucid AeonLucid reopened this Jan 4, 2021
@stale stale bot removed the stale label Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Stuff about the plugin api
Projects
None yet
4 participants