mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +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
|
@Override
|
||||||
public void scheduleUnload(UUID uuid) {
|
public void scheduleUnload(UUID uuid) {
|
||||||
plugin.getScheduler().doAsyncLater(() -> {
|
plugin.getScheduler().doAsyncLater(() -> {
|
||||||
User user = getIfLoaded(plugin.getUuidCache().getUUID(uuid));
|
// check once to see if the user can be unloaded.
|
||||||
if (user != null && !plugin.isPlayerOnline(uuid)) {
|
if (getIfLoaded(plugin.getUuidCache().getUUID(uuid)) != null && !plugin.isPlayerOnline(uuid)) {
|
||||||
user.unregisterData();
|
|
||||||
unload(user);
|
// 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);
|
}, 40L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,10 @@ public class AbstractStorage implements Storage {
|
|||||||
public CompletableFuture<Boolean> loadUser(UUID uuid, String username) {
|
public CompletableFuture<Boolean> loadUser(UUID uuid, String username) {
|
||||||
return makeFuture(() -> {
|
return makeFuture(() -> {
|
||||||
if (backing.loadUser(uuid, username)) {
|
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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user