From 5501e3a500d7d1218080dbbc49926a87c40681d0 Mon Sep 17 00:00:00 2001 From: D3v1s0m Date: Sat, 23 Dec 2023 16:28:26 +0530 Subject: [PATCH] Added config option for tab display name --- .../src/main/java/lol/pyr/znpcsplus/config/MainConfig.java | 5 +++++ .../java/lol/pyr/znpcsplus/packets/V1_8PacketFactory.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/config/MainConfig.java b/plugin/src/main/java/lol/pyr/znpcsplus/config/MainConfig.java index 61d5d1f..e90275b 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/config/MainConfig.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/config/MainConfig.java @@ -68,4 +68,9 @@ public interface MainConfig { }) @DefaultInteger(60) int tabHideDelay(); + + @ConfKey("tab-display-name") + @ConfComments("The display name to use for npcs in the player list (aka tab)") + @DefaultString("ZNPC{id}") + String tabDisplayName(); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8PacketFactory.java b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8PacketFactory.java index f06994c..029c68e 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8PacketFactory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8PacketFactory.java @@ -96,7 +96,7 @@ public class V1_8PacketFactory implements PacketFactory { CompletableFuture future = new CompletableFuture<>(); skinned(player, properties, new UserProfile(entity.getUuid(), Integer.toString(entity.getEntityId()))).thenAccept(profile -> { sendPacket(player, new WrapperPlayServerPlayerInfo( - WrapperPlayServerPlayerInfo.Action.ADD_PLAYER, new WrapperPlayServerPlayerInfo.PlayerData(Component.text(" "), + WrapperPlayServerPlayerInfo.Action.ADD_PLAYER, new WrapperPlayServerPlayerInfo.PlayerData(Component.text(configManager.getConfig().tabDisplayName().replace("{id}", Integer.toString(entity.getEntityId()))), profile, GameMode.CREATIVE, 1))); future.complete(null); });