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 PlayerTrackEntityEvent #8

Open
wants to merge 1 commit into
base: ver/1.8.8
Choose a base branch
from

Conversation

archer-321
Copy link

This PR adds a KigPaper-API way to hide entities from players. This change is useful when using entities to display something while not wanting other players to see the "visual noise".

This commit adds an event that gets fired whenever an entity is added to
a player's entity tracker. Cancelling this event prevents the entity
from being added, and consequently, the entity is never sent (nor
updated) for the player. While this is essentially the same method that
Bukkit's hidden player system uses, simply cancelling the event does
not make sure that the entity is not interacted with, and the player can
still see them in some places (e.g. in the player list and the
scoreboard).
@archer-321 archer-321 added the enhancement New feature or request label Feb 3, 2022
@archer-321 archer-321 requested a review from roccodev February 3, 2022 04:03
@archer-321 archer-321 self-assigned this Feb 3, 2022
@roccodev
Copy link
Member

roccodev commented Feb 3, 2022

I don't think this should be fired for player entities. As you explain, the proper way to hide players is via Player#hidePlayer, which already takes care of disabling trackers.

@archer-321
Copy link
Author

While this new API might mislead some users into implementing a vanish system from scratch, I think artificially limiting an API only because someone might not read the Javadoc isn't the right way to go.
Moreover, players are entities, so when the event claims that it's going to be fired for all entities (and if we leave the doc comments as they are right now), skipping the event for players would be a faulty implementation.

Originally, I had the event's Javadoc explicitly state that cancelling the event only hides the "player model" in-game while leaving everything else that mentions the player in place. Do you think that with this part added back to the class' comment, the chance of potential misuse would be acceptably low?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants