Paper
Paper copied to clipboard
Add Entity hidden by default flag
Allows entities to be hidden by default. Entities that are hidden by default are hidden from a Player until Player#showEntity is invoked on that entity. Players that join the server or relog will also not see entities that are hidden by default. The entity's tracker maintains a set of player connections that have been shown the entity.
Entities hidden by default respect other plugins' calls to Player#hideEntity. This means that, if Player#showEntity is called on an entity hidden by default, but the method was not called by the plugin that originally hid the entity, then the entity will still not be shown. If no other plugin hides the player when it is shown, then the entity will remain hidden by default but be shown to that Player.
The functionality is expanded for players that are hidden by default. Hiding players by default will send REMOVE_PLAYER PlayerInfo packets so that they are hidden in a similar fashion to hidePlayer calls. The same can be said when a player is no longer being hidden by default.
Test with my own test plugins, that hide entities and players by default and then show them to specific players. Leaving and rejoining was also tested.
Closes #7395
I know that the logic is not the same as https://github.com/PaperMC/Paper/pull/7666 but it close the same issue, so you should probably find a solution together
I know that the logic is not the same as #7666 but it close the same issue, so you should probably find a solution together
How should I go about doing this?
Rebased and removed the streams.
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/e8010dc93fbb163876d6c745970dd2d9b587b381?
Done by upstream https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/fb50924403915ad24e9389361a10dfbf53c1e696