Добавлен DisplayNameListener: префикс и цвет ника теперь отображаются возле ника в игре

This commit is contained in:
loki5512344 2025-12-30 20:38:08 +01:00
parent ee67dcc12a
commit 1d75327a4d
3 changed files with 153 additions and 0 deletions

View file

@ -53,6 +53,13 @@ public class ChatColorCommand implements CommandExecutor, TabCompleter {
// Сохраняем цвет чата игрока
plugin.getChatColorManager().setChatColor(player.getUniqueId(), color);
// Обновляем display name игрока
player.getScheduler().run(plugin, task -> {
if (plugin.getDisplayNameListener() != null) {
plugin.getDisplayNameListener().updatePlayerDisplayName(player);
}
}, null);
// Показываем пример с примененным цветом
String preview = ChatFormatter.convertAllColors(color + "Пример текста");
player.sendMessage(ChatFormatter.parse("<green>Цвет чата установлен! Пример: " + preview));