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

Allow Message to Player Event #2478

Open
wants to merge 6 commits into
base: 1.19.2
Choose a base branch
from

Conversation

BlueZeeKing
Copy link

@BlueZeeKing BlueZeeKing commented Aug 23, 2022

Message API ALLOW_MESSAGE_TO_PLAYER

Resolves

Implements some of #1147

What is this?

This adds the ALLOW_MESSAGE_TO_PLAYER event to ServerMessageEvents. It's similar to the ALLOW_COMMAND_MESSAGE and ALLOW_CHAT_MESSAGE but it operates on a per-player basis. It applies to any messages a player sends, including commands like /msg, /say, and /me and messages sent as normal chat messages through the GUI.

What does this not do?

This API does not apply to messages sent by anything other than a player.

Testing

This mod uses the same mixins that the former Message Channels used so all that testing is still useful. I further tested it using the current API with the /msg, /say, and /me commands. It was also tested on sending messages from things other than a player using /execute. The testmod blocks the player from seeing any message with their username in it.

Copy link
Contributor

@haykam821 haykam821 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation makes a few grammatical mistakes and does not follow the convention of prefixing @param and @return descriptions with lowercase letters.

Copy link
Contributor

@apple502j apple502j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe message channels are a bit out of scope. Mods can implement it easily now that AllowChatMessage event exists.

That said, if we do provide it, then we should use that event instead of mixin. Also how would message channel work with commands, particularly ones /executed?

@apple502j
Copy link
Contributor

Ah, this is per-player. Then we need a new event, yeah. That said we should provide this as generic event, not usage-specific one.

@BlueZeeKing
Copy link
Author

Ah, this is per-player. Then we need a new event, yeah. That said we should provide this as generic event, not usage-specific one.

I think you're right. I can keep the mixins the same and add the event.

@BlueZeeKing BlueZeeKing changed the title Message Channels Allow Message to Player Event Aug 27, 2022
Copy link
Contributor

@apple502j apple502j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: this does send header packet, so that's good

BlueZeeKing and others added 3 commits October 19, 2022 13:00
…ssage/v1/ServerMessageEvents.java

Co-authored-by: apple502j <[email protected]>
Co-authored-by: apple502j <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants