mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Fix users being cleaned up too early and then logging back into the server - closes #271
This commit is contained in:
parent
8326539d40
commit
7dc41e15d3
@ -142,12 +142,19 @@ public class GenericUserManager extends AbstractManager<UserIdentifier, User> im
|
||||
@Override
|
||||
public void scheduleUnload(UUID uuid) {
|
||||
plugin.getScheduler().doAsyncLater(() -> {
|
||||
User user = getIfLoaded(plugin.getUuidCache().getUUID(uuid));
|
||||
if (user != null && !plugin.isPlayerOnline(uuid)) {
|
||||
user.unregisterData();
|
||||
unload(user);
|
||||
// check once to see if the user can be unloaded.
|
||||
if (getIfLoaded(plugin.getUuidCache().getUUID(uuid)) != null && !plugin.isPlayerOnline(uuid)) {
|
||||
|
||||
// check again in 40 ticks, we want to be sure the player won't have re-logged before we unload them.
|
||||
plugin.getScheduler().doAsyncLater(() -> {
|
||||
User user = getIfLoaded(plugin.getUuidCache().getUUID(uuid));
|
||||
if (user != null && !plugin.isPlayerOnline(uuid)) {
|
||||
user.unregisterData();
|
||||
unload(user);
|
||||
plugin.getUuidCache().clearCache(uuid);
|
||||
}
|
||||
}, 40L);
|
||||
}
|
||||
plugin.getUuidCache().clearCache(uuid);
|
||||
}, 40L);
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,10 @@ public class AbstractStorage implements Storage {
|
||||
public CompletableFuture<Boolean> loadUser(UUID uuid, String username) {
|
||||
return makeFuture(() -> {
|
||||
if (backing.loadUser(uuid, username)) {
|
||||
plugin.getApiProvider().getEventFactory().handleUserLoad(plugin.getUserManager().getIfLoaded(uuid));
|
||||
User u = plugin.getUserManager().getIfLoaded(uuid);
|
||||
if (u != null) {
|
||||
plugin.getApiProvider().getEventFactory().handleUserLoad(u);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user