Velocity | While ServerConnectedEvent the old world context is still set
Nononitas opened this issue · 6 comments
Description
Firstly it's about the Velocity implementation:
If you check permission through Velocity's basic hasPermission method while the ServerConnectedEvent is running, the context does not appear to be correct.
Basically when you connect to the new server the context is still set to the old server. The problem is that I cannot use the ServerPostConnectEvent because there are certain packets between these events that I have to change.
My question is can the context be changed to the new server in this state?
By the way it works in the bungeecord implementation.
Reproduction Steps
Expected Behaviour
The context world is set to the new subserver because the player is connecting to the new one.
Server Details
Velocity 3.1.1 Build 98
LuckPerms Version
v5.3.89
Logs and Configs
No response
Extra Details
No response
Hey thanks for trying to fix that :)
Unfortunately this does not fix the problem. I see you just switched to another event where you invalidate the cache.
And as I see the permissions calculation itself gets the current server via player#getCurrentServer. The problem is that the server is always null/not present in the player's ServerConnectedEvent, so the context is still wrong while being in this state.
Ah ok then - if player#getCurrentServer is still reporting the old value, then I think it's reasonable that the context should too.
Yes I agree, but thats not what I meant.
The value is not present till ServerPostConnectEvent (getCurrentServer is an Optional).
So there is also then no context, although you know via ServerConnectedEvent where the player is connecting to.
I understood - I'm saying contexts are based on current data, not "what's about to happen".
I swapped to the ServerConnectedEvent on the assumption (based on your initial report) that the value would have changed by then - but if that's not the case then I'll swap it back.
If you think the behaviour of getCurrentServer is wrong, then you could try raising that with the Velocity authors.