forked from SteamWar/SteamWar
Show server name in local channel hover
This commit is contained in:
@@ -591,6 +591,7 @@ CHAT_FIGHT_REFEREE = §8» §e{0}
|
|||||||
CHAT_FIGHT_TEAM = §8» §f{0}
|
CHAT_FIGHT_TEAM = §8» §f{0}
|
||||||
CHAT_ICON = {0}{1}
|
CHAT_ICON = {0}{1}
|
||||||
CHAT_HOVER_TEAM = §7Team: §e{0}\n§7Prefix: §r{1}{2}
|
CHAT_HOVER_TEAM = §7Team: §e{0}\n§7Prefix: §r{1}{2}
|
||||||
|
CHAT_HOVER_LOCAL = {0}\n§7Server: §e{1}
|
||||||
CHAT_ICON_GLOBAL = 🌍
|
CHAT_ICON_GLOBAL = 🌍
|
||||||
CHAT_ICON_LOCAL = ⌂
|
CHAT_ICON_LOCAL = ⌂
|
||||||
CHAT_ICON_FIGHT = ⚔
|
CHAT_ICON_FIGHT = ⚔
|
||||||
|
|||||||
@@ -556,6 +556,7 @@ CHAT_FIGHT_REFEREE = §8» §e{0}
|
|||||||
CHAT_FIGHT_TEAM = §8» §f{0}
|
CHAT_FIGHT_TEAM = §8» §f{0}
|
||||||
CHAT_ICON = {0}{1}
|
CHAT_ICON = {0}{1}
|
||||||
CHAT_HOVER_TEAM = §7Team: §e{0}\n§7Kürzel: §r{1}{2}
|
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_GLOBAL = 🌍
|
||||||
CHAT_ICON_LOCAL = ⌂
|
CHAT_ICON_LOCAL = ⌂
|
||||||
CHAT_ICON_FIGHT = ⚔
|
CHAT_ICON_FIGHT = ⚔
|
||||||
|
|||||||
@@ -49,6 +49,13 @@ public abstract class ChatChannel {
|
|||||||
*/
|
*/
|
||||||
public abstract Message tag(Chatter receiver);
|
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.
|
* @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.
|
* 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);
|
Message icon = icon(receiver);
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
Component iconComponent = receiver.parse(new Message("CHAT_ICON", ChatManager.getDefault(receiver) == this ? "§e" : "§7", icon))
|
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();
|
msg = Component.text().append(iconComponent).append(Component.text(" ")).append(msg).build();
|
||||||
}
|
}
|
||||||
receiver.sendMessage(msg);
|
receiver.sendMessage(msg);
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ public class ChatManager extends BasicListener {
|
|||||||
Message icon = channel.icon(player);
|
Message icon = channel.icon(player);
|
||||||
Component iconComponent = icon == null ? player.parse(channel.tag(player)) : player.parse(new Message("CHAT_ICON", "§a", icon));
|
Component iconComponent = icon == null ? player.parse(channel.tag(player)) : player.parse(new Message("CHAT_ICON", "§a", icon));
|
||||||
player.sendMessage(Component.text()
|
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(Component.text(" "))
|
||||||
.append(player.parse(new Message("CHAT_CHANNEL_DEFAULT")))
|
.append(player.parse(new Message("CHAT_CHANNEL_DEFAULT")))
|
||||||
.build());
|
.build());
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ public class LocalChannel extends ChatChannel {
|
|||||||
return new Message("CHAT_CHANNEL_LOCAL");
|
return new Message("CHAT_CHANNEL_LOCAL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Message hover(Chatter receiver) {
|
||||||
|
return new Message("CHAT_HOVER_LOCAL", tag(receiver), server.getServerInfo().getName());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Message icon(Chatter receiver) {
|
protected Message icon(Chatter receiver) {
|
||||||
if (!isArena()) return new Message("CHAT_ICON_LOCAL");
|
if (!isArena()) return new Message("CHAT_ICON_LOCAL");
|
||||||
|
|||||||
Reference in New Issue
Block a user