From be915770b16e564866859197002f23b6cba0bc7b Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 16 Oct 2026 09:45:37 +0200 Subject: [PATCH] Show server name in local channel hover --- .../src/de/steamwar/messages/BungeeCore.properties | 1 + .../src/de/steamwar/messages/BungeeCore_de.properties | 1 + .../src/de/steamwar/velocitycore/chat/ChatChannel.java | 9 ++++++++- .../src/de/steamwar/velocitycore/chat/ChatManager.java | 2 +- .../src/de/steamwar/velocitycore/chat/LocalChannel.java | 5 +++++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties index 2f4f87a0..bb133b93 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties @@ -591,6 +591,7 @@ CHAT_FIGHT_REFEREE = §8» §e{0} CHAT_FIGHT_TEAM = §8» §f{0} CHAT_ICON = {0}{1} CHAT_HOVER_TEAM = §7Team: §e{0}\n§7Prefix: §r{1}{2} +CHAT_HOVER_LOCAL = {0}\n§7Server: §e{1} CHAT_ICON_GLOBAL = 🌍 CHAT_ICON_LOCAL = ⌂ CHAT_ICON_FIGHT = ⚔ diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties index 2cedc5b1..e7f26c99 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties @@ -556,6 +556,7 @@ CHAT_FIGHT_REFEREE = §8» §e{0} CHAT_FIGHT_TEAM = §8» §f{0} CHAT_ICON = {0}{1} CHAT_HOVER_TEAM = §7Team: §e{0}\n§7Kürzel: §r{1}{2} +CHAT_HOVER_LOCAL = {0}\n§7Server: §e{1} CHAT_ICON_GLOBAL = 🌍 CHAT_ICON_LOCAL = ⌂ CHAT_ICON_FIGHT = ⚔ diff --git a/VelocityCore/src/de/steamwar/velocitycore/chat/ChatChannel.java b/VelocityCore/src/de/steamwar/velocitycore/chat/ChatChannel.java index 9e8e5861..c560c12c 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/chat/ChatChannel.java +++ b/VelocityCore/src/de/steamwar/velocitycore/chat/ChatChannel.java @@ -49,6 +49,13 @@ public abstract class ChatChannel { */ public abstract Message tag(Chatter receiver); + /** + * @return the text shown when hovering the channel icon + */ + public Message hover(Chatter receiver) { + return tag(receiver); + } + /** * @return the icon always shown in front of messages of this channel, null if the message format already shows the channel. * The icon is highlighted if this is the default channel of the receiver. @@ -103,7 +110,7 @@ public abstract class ChatChannel { Message icon = icon(receiver); if (icon != null) { Component iconComponent = receiver.parse(new Message("CHAT_ICON", ChatManager.getDefault(receiver) == this ? "§e" : "§7", icon)) - .hoverEvent(HoverEvent.showText(receiver.parse(tag(receiver)))); + .hoverEvent(HoverEvent.showText(receiver.parse(hover(receiver)))); msg = Component.text().append(iconComponent).append(Component.text(" ")).append(msg).build(); } receiver.sendMessage(msg); diff --git a/VelocityCore/src/de/steamwar/velocitycore/chat/ChatManager.java b/VelocityCore/src/de/steamwar/velocitycore/chat/ChatManager.java index a88b55c3..bcdabf7e 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/chat/ChatManager.java +++ b/VelocityCore/src/de/steamwar/velocitycore/chat/ChatManager.java @@ -371,7 +371,7 @@ public class ChatManager extends BasicListener { Message icon = channel.icon(player); Component iconComponent = icon == null ? player.parse(channel.tag(player)) : player.parse(new Message("CHAT_ICON", "§a", icon)); player.sendMessage(Component.text() - .append(iconComponent.hoverEvent(HoverEvent.showText(player.parse(channel.tag(player))))) + .append(iconComponent.hoverEvent(HoverEvent.showText(player.parse(channel.hover(player))))) .append(Component.text(" ")) .append(player.parse(new Message("CHAT_CHANNEL_DEFAULT"))) .build()); diff --git a/VelocityCore/src/de/steamwar/velocitycore/chat/LocalChannel.java b/VelocityCore/src/de/steamwar/velocitycore/chat/LocalChannel.java index b4e4892d..a32d3f23 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/chat/LocalChannel.java +++ b/VelocityCore/src/de/steamwar/velocitycore/chat/LocalChannel.java @@ -63,6 +63,11 @@ public class LocalChannel extends ChatChannel { return new Message("CHAT_CHANNEL_LOCAL"); } + @Override + public Message hover(Chatter receiver) { + return new Message("CHAT_HOVER_LOCAL", tag(receiver), server.getServerInfo().getName()); + } + @Override protected Message icon(Chatter receiver) { if (!isArena()) return new Message("CHAT_ICON_LOCAL");