Add a way to manually synchronize Attachments
Say you have a group of players as an attachment predicate with which you want to sync a value. As soon as you add or remove a player from this they aren't notified of the current attachment state. Having an option to manually synchronize an attachment for a Player would make it possible to fix this issue by synchronizing the attachment for said player after adding/removing from the group. Additionally, it might be helpful to synchronize an attachment to a player with a specific value. As an example, if I wanted to sync the default value when removing an player from the group instead of the current value.
I may have misunderstood you, but can't you already do this with AttachmentSyncPredicate? Maybe you should describe your problem in more detail and then a potential solution.
I may have misunderstood you, but can't you already do this with AttachmentSyncPredicate? Maybe you should describe your problem in more detail and then a potential solution.
Say this is your attachment type and predicate:
//The level (world) has an AttachmentType<Boolean> FUNNY, only funny players in List<Player> funnyPlayers should know whether the world is funny or not, therefore the attachment sync predicate:
(target, player) -> funnyPlayers.contains(player)
When adding a player to the list, the current value of the attachment does not get synced with him.
When removing the player, the value of the attachment gets stuck at the last one, instead of resetting to the default value, as an example.
Having something like
player.setClientAttached(AttachmentTarget target, AttachmentType<T> type, T value)
player.updateClientAttached(AttachmentTarget target, AttachmentType<T> type) //basically setClientAttached but with the current attachment value
Which simply sends a sync packet for the attachment with any value to the client (without actually setting the value on the serverside) would allow you to do this:
//The level (world) has an AttachmentType<Boolean> FUNNY, only funny players in List<Player> funnyPlayers should know whether the world is funny or not, therefore the attachment predicate:
(target, player) -> funnyPlayers.contains(player);
//When adding a player
funnyPlayers.add(player);
player.updateClientAttached(level, FUNNY);
//When removing a player
funnyPlayers.remove(player);
player.setClientAttached(level, FUNNY, false); //send the default value