diff --git a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabList.java b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabList.java index b207ce4bf..9565dc9e5 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabList.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabList.java @@ -110,8 +110,12 @@ public class VelocityTabList implements InternalTabList { if (!Objects.equals(previousEntry.getDisplayNameComponent().orElse(null), entry.getDisplayNameComponent().orElse(null))) { actions.add(UpsertPlayerInfo.Action.UPDATE_DISPLAY_NAME); - playerInfoEntry.setDisplayName(new ComponentHolder(player.getProtocolVersion(), - entry.getDisplayNameComponent().get())); + playerInfoEntry.setDisplayName(entry.getDisplayNameComponent().isEmpty() + ? + null : + new ComponentHolder(player.getProtocolVersion(), + entry.getDisplayNameComponent().get()) + ); } if (!Objects.equals(previousEntry.getLatency(), entry.getLatency())) { actions.add(UpsertPlayerInfo.Action.UPDATE_LATENCY); @@ -140,8 +144,12 @@ public class VelocityTabList implements InternalTabList { playerInfoEntry.setProfile(entry.getProfile()); if (entry.getDisplayNameComponent().isPresent()) { actions.add(UpsertPlayerInfo.Action.UPDATE_DISPLAY_NAME); - playerInfoEntry.setDisplayName(new ComponentHolder(player.getProtocolVersion(), - entry.getDisplayNameComponent().get())); + playerInfoEntry.setDisplayName(entry.getDisplayNameComponent().isEmpty() + ? + null : + new ComponentHolder(player.getProtocolVersion(), + entry.getDisplayNameComponent().get()) + ); } if (entry.getChatSession() != null) { actions.add(UpsertPlayerInfo.Action.INITIALIZE_CHAT); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListEntry.java b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListEntry.java index c6adc7d21..c6649070b 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListEntry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabListEntry.java @@ -80,7 +80,11 @@ public class VelocityTabListEntry implements TabListEntry { this.displayName = displayName; UpsertPlayerInfo.Entry upsertEntry = this.tabList.createRawEntry(this); upsertEntry.setDisplayName( - new ComponentHolder(this.tabList.getPlayer().getProtocolVersion(), displayName)); + displayName == null + ? + null : + new ComponentHolder(this.tabList.getPlayer().getProtocolVersion(), displayName) + ); this.tabList.emitActionRaw(UpsertPlayerInfo.Action.UPDATE_DISPLAY_NAME, upsertEntry); return this; }