Added config option for tab display name

This commit is contained in:
D3v1s0m 2023-12-23 16:28:26 +05:30
parent 5b1a698d0f
commit 5501e3a500
No known key found for this signature in database
GPG Key ID: FA1F770C7B1D40C1
2 changed files with 6 additions and 1 deletions

@ -68,4 +68,9 @@ public interface MainConfig {
}) })
@DefaultInteger(60) @DefaultInteger(60)
int tabHideDelay(); 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();
} }

@ -96,7 +96,7 @@ public class V1_8PacketFactory implements PacketFactory {
CompletableFuture<Void> future = new CompletableFuture<>(); CompletableFuture<Void> future = new CompletableFuture<>();
skinned(player, properties, new UserProfile(entity.getUuid(), Integer.toString(entity.getEntityId()))).thenAccept(profile -> { skinned(player, properties, new UserProfile(entity.getUuid(), Integer.toString(entity.getEntityId()))).thenAccept(profile -> {
sendPacket(player, new WrapperPlayServerPlayerInfo( 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))); profile, GameMode.CREATIVE, 1)));
future.complete(null); future.complete(null);
}); });