diff --git a/common/src/main/java/net/william278/huskhomes/listener/EventListener.java b/common/src/main/java/net/william278/huskhomes/listener/EventListener.java index 2bb822e2..7c764599 100644 --- a/common/src/main/java/net/william278/huskhomes/listener/EventListener.java +++ b/common/src/main/java/net/william278/huskhomes/listener/EventListener.java @@ -105,8 +105,10 @@ protected final void handlePlayerJoin(@NotNull OnlineUser onlineUser) { */ protected final void handlePlayerLeave(@NotNull OnlineUser online) { online.removeInvulnerabilityIfPermitted(); + plugin.getOnlineUserMap().remove(online.getUuid()); + plugin.runAsync(() -> { - // Set offline position + // Set offline position plugin.getDatabase().setOfflinePosition(online, online.getPosition()); // Remove this user's home cache @@ -125,9 +127,6 @@ protected final void handlePlayerLeave(@NotNull OnlineUser online) { .findAny() .ifPresent(player -> this.updateUserList(player, users)); } - - // Remove from user map - plugin.getOnlineUserMap().remove(online.getUuid()); }); }