Fix /ccols list always showing all default colours, even when they haven't been modified

This commit is contained in:
UnknownShadow200 2018-06-11 23:53:52 +10:00
parent 52d882cbc3
commit c2022c589a
6 changed files with 11 additions and 11 deletions

View File

@ -68,10 +68,10 @@ namespace MCGalaxy {
return message;
}
/// <summary> Returns true if the target player can see chat messags by source. </summary>
public static bool NotIgnoring(Player target, Player source) {
if (target.Ignores.All) return source == target; // don't ignore messages from self
return source == null || !target.Ignores.Names.CaselessContains(source.name);
/// <summary> Returns true if the target player is ignoring chat messags by source. </summary>
public static bool Ignoring(Player target, Player source) {
if (target.Ignores.All) return source != target; // don't ignore messages from self
return source != null && target.Ignores.Names.CaselessContains(source.name);
}
@ -162,7 +162,7 @@ namespace MCGalaxy {
if (!scopeFilter(pl, arg)) continue;
if (filter != null && !filter(pl, arg)) continue;
if (!NotIgnoring(pl, source)) continue;
if (Ignoring(pl, source)) continue;
Player.Message(pl, UnescapeMessage(pl, source, msg));
}
}
@ -186,7 +186,7 @@ namespace MCGalaxy {
OnChatEvent.Call(scope, source, msg, arg, ref filter, irc);
foreach (Player pl in players) {
if (!NotIgnoring(pl, source)) continue;
if (Ignoring(pl, source)) continue;
// Always show message to self too (unless ignoring self)
if (pl != source) {
if (!scopeFilter(pl, arg)) continue;

View File

@ -86,7 +86,7 @@ namespace MCGalaxy.Commands.CPE {
static void ListHandler(Player p, string cmd, string modifier) {
List<ColorDesc> validCols = new List<ColorDesc>(Colors.List.Length);
foreach (ColorDesc col in Colors.List) {
if (!col.Undefined) validCols.Add(col);
if (col.IsModified()) validCols.Add(col);
}
MultiPageOutput.Output(p, validCols, FormatColor, cmd, "Colors", modifier, true);
}

View File

@ -53,7 +53,7 @@ namespace MCGalaxy.Commands.Chatting {
PlayerInfo.GetColoredName(p, receiverName));
if (receiver == null) return;
if (Chat.NotIgnoring(receiver, p)) {
if (!Chat.Ignoring(receiver, p)) {
Player.Message(receiver, "Message recieved from {0}%S. Check %T/inbox", senderNick);
}
}

View File

@ -27,7 +27,7 @@ namespace MCGalaxy.Commands.Chatting {
string reciever = p == target ? "themselves" : target.ColoredName;
if (!TryMessage(p, msg.Replace("λTARGET", reciever))) return false;
if (messageWho && p != target && Chat.NotIgnoring(target, p)) {
if (messageWho && p != target && !Chat.Ignoring(target, p)) {
string giver = (p == null) ? "(console)" : p.ColoredName;
msg = msg.Replace("λNICK", giver);
Player.Message(target, msg.Replace("λTARGET", "you"));

View File

@ -77,7 +77,7 @@ namespace MCGalaxy.Commands.Misc {
}
static void ShowRequestMessage(Player p, Player target) {
if (!Chat.NotIgnoring(target, p)) return;
if (Chat.Ignoring(target, p)) return;
Player.Message(target, p.ColoredName + " %Swould like to teleport to you.");
Player.Message(target, "Type &2/tpaccept %Sor &4/tpdeny%S.");

View File

@ -40,7 +40,7 @@ namespace MCGalaxy.Core {
ChatMessageFilter scopeFilter = Chat.scopeFilters[(int)scope];
foreach (Player pl in players) {
if (pl == source || !Chat.NotIgnoring(pl, source)) continue;
if (pl == source || Chat.Ignoring(pl, source)) continue;
if (!scopeFilter(pl, arg)) continue;
if (filter != null && !filter(pl, arg)) continue;