forked from SteamWar/SteamWar
Show channel tags as plain gray prefix
Messages from a channel that is not the receiver's default are now prefixed with the plain channel name in dark gray instead of brackets. Direct messages get no tag, as their format already shows sender and receiver.
This commit is contained in:
@@ -583,7 +583,7 @@ CHAT_FIGHT_PARTICIPANT = {0} {1}§8» §7{2}
|
||||
CHAT_FIGHT_SPECTATOR = §7{0}§8» §7{1}
|
||||
CHAT_FIGHT_REFEREE = §e{0}§8» §e{1}
|
||||
CHAT_FIGHT_TEAM = {0} {1}§8» §f{2}
|
||||
CHAT_TAGGED = §8[{0}§8] §r{1}
|
||||
CHAT_TAGGED = §8{0} §r{1}
|
||||
CHAT_CHANNEL_GLOBAL = §eGlobal
|
||||
CHAT_CHANNEL_ARENA = §e{0}
|
||||
CHAT_CHANNEL_FIGHT_TEAM = §e{0} {1}
|
||||
|
||||
@@ -548,7 +548,7 @@ CHAT_FIGHT_PARTICIPANT = {0} {1}§8» §7{2}
|
||||
CHAT_FIGHT_SPECTATOR = §7{0}§8» §7{1}
|
||||
CHAT_FIGHT_REFEREE = §e{0}§8» §e{1}
|
||||
CHAT_FIGHT_TEAM = {0} {1}§8» §f{2}
|
||||
CHAT_TAGGED = §8[{0}§8] §r{1}
|
||||
CHAT_TAGGED = §8{0} §r{1}
|
||||
CHAT_CHANNEL_GLOBAL = §eGlobal
|
||||
CHAT_CHANNEL_ARENA = §e{0}
|
||||
CHAT_CHANNEL_FIGHT_TEAM = §e{0} {1}
|
||||
|
||||
@@ -47,6 +47,13 @@ public abstract class ChatChannel {
|
||||
*/
|
||||
public abstract Message tag(Chatter receiver);
|
||||
|
||||
/**
|
||||
* @return false if the message format already shows the channel, so no tag is put in front
|
||||
*/
|
||||
protected boolean tagged() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract Stream<Chatter> readers();
|
||||
|
||||
/**
|
||||
@@ -90,8 +97,8 @@ public abstract class ChatChannel {
|
||||
if (!receiver.chatShown()) continue;
|
||||
|
||||
Message msg = format(receiver, sender, coloredMessage);
|
||||
if (ChatManager.getDefault(receiver) != this) {
|
||||
msg = new Message("CHAT_TAGGED", tag(receiver), msg);
|
||||
if (tagged() && ChatManager.getDefault(receiver) != this) {
|
||||
msg = new Message("CHAT_TAGGED", receiver.parseToPlain(tag(receiver)), msg);
|
||||
}
|
||||
receiver.send(false, null, null, msg);
|
||||
|
||||
|
||||
@@ -59,6 +59,11 @@ public class DirectChannel extends ChatChannel {
|
||||
return new Message("CHAT_CHANNEL_MSG", SteamwarUser.get(partner(receiver.user().getUUID())));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean tagged() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<Chatter> readers() {
|
||||
return Stream.of(first, second)
|
||||
|
||||
Reference in New Issue
Block a user