diff --git a/src/main/java/net/william278/velocitab/hook/LuckPermsHook.java b/src/main/java/net/william278/velocitab/hook/LuckPermsHook.java index b24df71..4b2d554 100644 --- a/src/main/java/net/william278/velocitab/hook/LuckPermsHook.java +++ b/src/main/java/net/william278/velocitab/hook/LuckPermsHook.java @@ -19,6 +19,7 @@ package net.william278.velocitab.hook; +import com.google.common.collect.Maps; import com.velocitypowered.api.proxy.Player; import net.luckperms.api.LuckPerms; import net.luckperms.api.LuckPermsProvider; @@ -34,7 +35,6 @@ import net.william278.velocitab.tab.PlayerTabList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.HashMap; import java.util.Map; import java.util.Optional; import java.util.UUID; @@ -49,7 +49,7 @@ public class LuckPermsHook extends Hook { public LuckPermsHook(@NotNull Velocitab plugin) throws IllegalStateException { super(plugin); this.api = LuckPermsProvider.get(); - this.lastUpdate = new HashMap<>(); + this.lastUpdate = Maps.newConcurrentMap(); this.event = api.getEventBus().subscribe( plugin, UserDataRecalculateEvent.class, this::onLuckPermsGroupUpdate ); diff --git a/src/main/java/net/william278/velocitab/packet/PacketEventManager.java b/src/main/java/net/william278/velocitab/packet/PacketEventManager.java index 7459468..4616214 100644 --- a/src/main/java/net/william278/velocitab/packet/PacketEventManager.java +++ b/src/main/java/net/william278/velocitab/packet/PacketEventManager.java @@ -101,6 +101,7 @@ public class PacketEventManager { .map(id -> plugin.getTabList().getTabPlayer(id)) .filter(Optional::isPresent) .map(Optional::get) + .filter(TabPlayer::isLoaded) .toList(); if (toUpdate.isEmpty()) { @@ -108,8 +109,7 @@ public class PacketEventManager { } toUpdate.forEach(tabPlayer -> packet.getEntries().stream() - .filter(entry -> entry.getProfile() != null) - .filter(entry -> entry.getProfile().getId().equals(tabPlayer.getPlayer().getUniqueId())) + .filter(entry -> entry.getProfileId().equals(tabPlayer.getPlayer().getUniqueId())) .findFirst() .ifPresent(entry -> entry.setDisplayName( new ComponentHolder(player.getProtocolVersion(), tabPlayer.getLastDisplayname()))));