World context ignored after server change
fgardt opened this issue ยท 4 comments
Description
I run a couple of servers behind Velocity and want to use the RememberMe plugin to auto connect to the last connected server. But that also causes players to get connected into the lobby on a reconnect if they got sent there due to the actual game server going down.
I wanted to fix this by introducing a new permission to RememberMe rememberme.notracking
which would be true
for the lobby server.
Without any contexts set on the permission my modification of RememberMe works as expected: it doesn't track any server changes at all.
With a context for world=lobby
however it would still track players in the lobby. I also adding the permission for every server with the corresponding context to check if that would disable the tracking again but it didn't.
When checking for the permission ingame it showed correctly.
Reproduction steps
- Velocity server setup with 2 backend servers
- LuckPerms installed on the Velocity server
- Compile the modified RememberMe from here and install it on Velocity
- Set the permission
rememberme.notracking
totrue
with corresponding contexts to test - Use
/lpv user USERNAME meta info
to check thelast-server
info
Expected behaviour
Respect the permissions context even immediately after a server change.
Environment details
- Server type/version:
Velocity
version3.0.0
- LuckPerms version:
v5.3.57
Any other relevant details
The server
context is not ignored (but is not useful since its only 1 "server" aka proxy)
Code responsible for the behaviour in RememberMe:
@Subscribe
public void onServerChange(ServerConnectedEvent serverConnectedEvent) {
if (!serverConnectedEvent.getPlayer().hasPermission("rememberme.notracking")) {
handler.setLastServerName(serverConnectedEvent.getPlayer().getUniqueId(), serverConnectedEvent.getServer().getServerInfo().getName());
}
}
It should be invalidating when that event fires.
Does serverConnectedEvent.getPlayer().getCurrentServer().getServerInfo()
return the expected value during that event?
Can confirm that this fixed it.
(I also changed the event on the rememberme plugin to ServerPostConnectEvent
)
Using verbose to further inspect this issue indeed confirms that at the time when the permission gets checked neither the old nor the new world context are set.
https://luckperms.net/verbose/bwjkR0UD8f
When running verbose on a different permission for a command to test for the contexts the correct world context is set.
https://luckperms.net/verbose/DstqjFTcDn
note: I changed the onServerChange
eventlistener to @Subscribe(order = PostOrder.LAST)
but this didn't change anything.
Is there some way I can properly wait for LuckPerms to update contexts after a server change?