mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-28 20:17:55 +01:00
Force a clear of transient nodes when a User quits, don't just rely on their instance being unloaded
This commit is contained in:
parent
72d4e5cf7a
commit
f18d230ff6
@ -202,6 +202,14 @@ public class BukkitConnectionListener extends AbstractLoginListener implements L
|
||||
// Register with the housekeeper, so the User's instance will stick
|
||||
// around for a bit after they disconnect
|
||||
this.plugin.getUserManager().getHouseKeeper().registerUsage(player.getUniqueId());
|
||||
|
||||
// force a clear of transient nodes
|
||||
this.plugin.getScheduler().doAsync(() -> {
|
||||
User user = this.plugin.getUserManager().getIfLoaded(player.getUniqueId());
|
||||
if (user != null) {
|
||||
user.clearTransientNodes();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -132,9 +132,19 @@ public class BungeeConnectionListener extends AbstractLoginListener implements L
|
||||
// Wait until the last priority to unload, so plugins can still perform permission checks on this event
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerQuit(PlayerDisconnectEvent e) {
|
||||
ProxiedPlayer player = e.getPlayer();
|
||||
|
||||
// Register with the housekeeper, so the User's instance will stick
|
||||
// around for a bit after they disconnect
|
||||
this.plugin.getUserManager().getHouseKeeper().registerUsage(e.getPlayer().getUniqueId());
|
||||
this.plugin.getUserManager().getHouseKeeper().registerUsage(player.getUniqueId());
|
||||
|
||||
// force a clear of transient nodes
|
||||
this.plugin.getScheduler().doAsync(() -> {
|
||||
User user = this.plugin.getUserManager().getIfLoaded(player.getUniqueId());
|
||||
if (user != null) {
|
||||
user.clearTransientNodes();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.utils.AbstractLoginListener;
|
||||
import me.lucko.luckperms.sponge.LPSpongePlugin;
|
||||
|
||||
import org.spongepowered.api.entity.living.player.Player;
|
||||
import org.spongepowered.api.event.Listener;
|
||||
import org.spongepowered.api.event.Order;
|
||||
import org.spongepowered.api.event.filter.IsCancelled;
|
||||
@ -157,9 +158,19 @@ public class SpongeConnectionListener extends AbstractLoginListener {
|
||||
|
||||
@Listener(order = Order.POST)
|
||||
public void onClientLeave(ClientConnectionEvent.Disconnect e) {
|
||||
Player player = e.getTargetEntity();
|
||||
|
||||
// Register with the housekeeper, so the User's instance will stick
|
||||
// around for a bit after they disconnect
|
||||
this.plugin.getUserManager().getHouseKeeper().registerUsage(e.getTargetEntity().getUniqueId());
|
||||
this.plugin.getUserManager().getHouseKeeper().registerUsage(player.getUniqueId());
|
||||
|
||||
// force a clear of transient nodes
|
||||
this.plugin.getScheduler().doAsync(() -> {
|
||||
User user = this.plugin.getUserManager().getIfLoaded(player.getUniqueId());
|
||||
if (user != null) {
|
||||
user.clearTransientNodes();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user