From 91962a08c95f4e54abccf7ceee5c9c50a29745fb Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 28 Nov 2016 08:36:17 +1100 Subject: [PATCH] core: prevent bypassing /ignore --- MCGalaxy/Commands/Chat/MessageCmd.cs | 4 +++- MCGalaxy/Commands/Information/CmdAfk.cs | 6 ++++-- MCGalaxy/Commands/Information/CmdUnloaded.cs | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/MCGalaxy/Commands/Chat/MessageCmd.cs b/MCGalaxy/Commands/Chat/MessageCmd.cs index 2a2b48ad5..e5a14fc5e 100644 --- a/MCGalaxy/Commands/Chat/MessageCmd.cs +++ b/MCGalaxy/Commands/Chat/MessageCmd.cs @@ -30,7 +30,9 @@ namespace MCGalaxy.Commands { string giver = (p == null) ? "(console)" : p.ColoredName; if (!TryMessage(p, string.Format(message, giver, who.ColoredName))) return false; - if (messageWho && !who.listignored.Contains(giver)) + + string giverRaw = (p == null) ? "(console)" : p.name; + if (messageWho && !who.listignored.Contains(giverRaw)) Player.Message(who, string.Format(message, giver, "you")); return true; } diff --git a/MCGalaxy/Commands/Information/CmdAfk.cs b/MCGalaxy/Commands/Information/CmdAfk.cs index d563c665e..d6cb6449d 100644 --- a/MCGalaxy/Commands/Information/CmdAfk.cs +++ b/MCGalaxy/Commands/Information/CmdAfk.cs @@ -49,7 +49,8 @@ namespace MCGalaxy.Commands { if (cantSend) { Player.Message(p, "You are now marked as being AFK."); } else { - Chat.MessageWhere("-{0}%S- is AFK {1}", pl => Entities.CanSee(pl, p), + Chat.MessageWhere("-{0}%S- is AFK {1}", + pl => Entities.CanSee(pl, p) && !pl.listignored.Contains(p.name), p.ColoredName, message); Player.RaisePlayerAction(p, PlayerAction.AFK, message); p.CheckForMessageSpam(); @@ -63,7 +64,8 @@ namespace MCGalaxy.Commands { if (cantSend) { Player.Message(p, "You are no longer marked as being AFK."); } else { - Chat.MessageWhere("-{0}%S- is no longer AFK", pl => Entities.CanSee(pl, p), + Chat.MessageWhere("-{0}%S- is no longer AFK", + pl => Entities.CanSee(pl, p) && !pl.listignored.Contains(p.name), p.ColoredName); Player.RaisePlayerAction(p, PlayerAction.UnAFK, message); p.CheckForMessageSpam(); diff --git a/MCGalaxy/Commands/Information/CmdUnloaded.cs b/MCGalaxy/Commands/Information/CmdUnloaded.cs index f3ce4d0ea..33b52397f 100644 --- a/MCGalaxy/Commands/Information/CmdUnloaded.cs +++ b/MCGalaxy/Commands/Information/CmdUnloaded.cs @@ -42,7 +42,7 @@ namespace MCGalaxy.Commands { Level[] loaded = LevelInfo.Loaded.Items; foreach (string file in files) { - string map = Path.GetFileNameWithoutExtension(file); + string map = Path.GetFileNameWithoutExtension(file); if (IsLoaded(loaded, map)) continue; maps.Add(map); }