LuckPerms

LuckPerms

41.4k Downloads

PostSyncEvent doesn't care about a network sync

robinstiege opened this issue ยท 1 comments

commented

I'm not sure whether this is a bug or expected behaviour.

I registered the PostSyncEvent which works fine for server-only-syncs /lp sync. But when I do a group assignment over the bungeecord or a network-sync /lpb sync the PostSyncEvent is not fired (the server receives the ping over the plugin messaging channel).

I found out that theres already an event PreNetworkSyncEvent but not a PostNetworkSyncEvent.

Is there an option to get this working?

commented

Luck - Last Saturday at 22:52
Hey @rasre are you super super sure? :p
just saw your github issue & checked the code

Rasre - Last Saturday at 22:53
Mhmm not super super sure... But tested it a few times and it won't be triggered. I can try one more time and also check mine... Gimme some minutes.

Luck - Last Saturday at 22:53
the post sync event is definitely called each time a sync occurs
https://github.com/lucko/LuckPerms/blob/master/common/src/main/java/me/lucko/luckperms/common/tasks/SyncTask.java#L83
It won't be called however if you cancel the PreSyncEvent
or the network pre sync event

Rasre - Last Saturday at 22:54
Sure you are sure that if the bungeecord plugin performs a sync, my spigot plugins also get notified via the PostSyncEvent?

Luck - Last Saturday at 22:55
Assuming your messaging service is all setup correctly
then yes

Rasre - Last Saturday at 22:55
I'll try...

Luck - Last Saturday at 22:56
or in other words
if the PreSyncEvent is called, and is not set to cancelled, then the PostSyncEvent should definitely be called sometime afterwards(edited)

Rasre - Last Saturday at 22:57
Ok, I tried /lpb user Rasre parent set leitung which gives me [22:56:44 INFO]: [LuckPerms] [Messaging] Received user update ping for 'rasre' with id: b695db70-ead7-4b30-ada5-82a10f35a45d on my lobby server. So I'm assuming that plugin messaging is working correctly?

Luck - Last Saturday at 22:58
Yep
but a "user update ping" doesn't cause a full sync task

Rasre - Last Saturday at 22:58
Oh

Luck - Last Saturday at 22:58
only a reload of that users data

Rasre - Last Saturday at 22:58
Okay /lpb networksync works fine I see

Luck - Last Saturday at 22:59
Mhmm

Rasre - Last Saturday at 22:59
So is there an option to enable a full sync for incoming ping?
Or an event I can listen to

Luck - Last Saturday at 23:00
Well, a full sync isn't necessary
So idk why you'd want to enable that

Rasre - Last Saturday at 23:01
Just to get the event working XD

Luck - Last Saturday at 23:01
Do you just want to listen for when users are updated?

Rasre - Last Saturday at 23:01
Yes

Luck - Last Saturday at 23:01
okay well
the UserLoadEvent will be fired

Rasre - Last Saturday at 23:02
Well, that would be nice. Let me try.

Luck - Last Saturday at 23:02
or more generally when any User related data changes
UserDataRecalculateEvent is called

Rasre - Last Saturday at 23:03
Aww that works like a charm ๐Ÿ˜„
Okay, then I'll use UserDataRecalculateEvent for that
I'm listening to this now:
eventBus.subscribe(UserDataRecalculateEvent.class, e -> refreshAll());
eventBus.subscribe(PostSyncEvent.class, e -> refreshAll());
eventBus.subscribe(NodeAddEvent.class, e -> refreshAll());
eventBus.subscribe(NodeRemoveEvent.class, e -> refreshAll());
eventBus.subscribe(NodeMutateEvent.class, e -> refreshAll());

Luck - Last Saturday at 23:05
you only need to listen to UserDataRecalculateEvent
and then refresh data for that specific user
that will cover all of the other events too

Rasre - Last Saturday at 23:05
Cool!
Thank you Luck ๐Ÿ˜ƒ