-
Notifications
You must be signed in to change notification settings - Fork 433
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
base: 1.19.2
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
fabric-message-api-v1/src/main/java/net/fabricmc/fabric/api/message/v1/MessageChannels.java
Outdated
Show resolved
Hide resolved
fabric-message-api-v1/src/main/java/net/fabricmc/fabric/api/message/v1/MessageChannels.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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?
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. |
There was a problem hiding this 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
fabric-message-api-v1/src/main/java/net/fabricmc/fabric/api/message/v1/ServerMessageEvents.java
Outdated
Show resolved
Hide resolved
fabric-message-api-v1/src/main/java/net/fabricmc/fabric/api/message/v1/ServerMessageEvents.java
Outdated
Show resolved
Hide resolved
fabric-message-api-v1/src/main/java/net/fabricmc/fabric/api/message/v1/ServerMessageEvents.java
Outdated
Show resolved
Hide resolved
...-message-api-v1/src/main/java/net/fabricmc/fabric/mixin/message/ServerPlayerEntityMixin.java
Outdated
Show resolved
Hide resolved
…ssage/v1/ServerMessageEvents.java Co-authored-by: apple502j <[email protected]>
Co-authored-by: apple502j <[email protected]>
Co-authored-by: apple502j <[email protected]>
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
andALLOW_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.