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

feat: player predicate to control who to send info entries to #2113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DeidaraMC
Copy link
Collaborator

Addresses issue #2076
Currently Minestom has no way to prevent info entries from being sent to players through the API.

This change introduces a predicate to implement custom logic against who should receive entry packets from a player

Simple example, only send entries to other players who are in a specific list
player.setInfoEntryUpdateRule(receiver -> list.contains(receiver))

@Steanky
Copy link
Contributor

Steanky commented Jul 7, 2024

Would it be better to raise an event instead of using a predicate? Benefits are multiple listeners can modify the tablist recipients. Could be something like PlayerTablistAddEvent, PlayerTablistRemoveEvent, both would include a modifiable List representing the players receiving the packets. Also wouldn't have to evaluate a predicate against every player on the network every time someone joins.

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.

2 participants