Detach from permissible objects with a 1 tick delay after player quit to allow plugins listening on monitor to still access data (#1220)

This commit is contained in:
Luck
2018-09-20 11:07:20 +01:00
Unverified
parent 11a3ecbba0
commit 04e511026d
7 changed files with 54 additions and 89 deletions
@@ -166,19 +166,7 @@ public class SpongeConnectionListener extends AbstractConnectionListener {
@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(player.getUniqueId());
// force a clear of transient nodes
this.plugin.getBootstrap().getScheduler().executeAsync(() -> {
User user = this.plugin.getUserManager().getIfLoaded(player.getUniqueId());
if (user != null) {
user.clearTransientNodes();
}
});
handleDisconnect(e.getTargetEntity().getUniqueId());
}
}