9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-28 19:39:14 +00:00

fix: check if entity is null after offhand swap event

This commit is contained in:
LoJoSho
2024-05-20 11:09:45 -05:00
parent ea25dcf208
commit de1e5bf100

View File

@@ -287,6 +287,7 @@ public class PlayerGameListener implements Listener {
return;
}
Bukkit.getScheduler().runTaskLater(HMCCosmeticsPlugin.getInstance(), () -> {
if (user.getEntity() == null) return; // Player has likely logged off
user.updateCosmetic(CosmeticSlot.OFFHAND);
List<Player> viewers = HMCCPacketManager.getViewers(user.getEntity().getLocation());
if (viewers.isEmpty()) return;