From 80884967e240d581550ede98657625c7ae12d0ad Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 3 Jun 2024 20:09:16 +1000 Subject: [PATCH] Non-public mod action logs should still be relayed to non-public channels on external relays --- MCGalaxy/CorePlugin/ModActionHandler.cs | 3 ++- MCGalaxy/Modules/Moderation/Notes/CmdNote.cs | 15 ++++++++++----- .../Modules/Moderation/Notes/NotesPlugin.cs | 17 +++++++++-------- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/MCGalaxy/CorePlugin/ModActionHandler.cs b/MCGalaxy/CorePlugin/ModActionHandler.cs index f02a5963e..aa292eb93 100644 --- a/MCGalaxy/CorePlugin/ModActionHandler.cs +++ b/MCGalaxy/CorePlugin/ModActionHandler.cs @@ -54,7 +54,8 @@ static void LogAction(ModAction e, Player target, string action) { Chat.Message(ChatScope.Global, e.FormatMessage(targetNick, action), null, null, true); } else { - Chat.MessageOps("To Ops: " + e.FormatMessage(targetNick, action)); + Chat.Message(ChatScope.Perms, "To Ops: " + e.FormatMessage(targetNick, action), + Chat.OpchatPerms, null, true); } action = Colors.StripUsed(action); diff --git a/MCGalaxy/Modules/Moderation/Notes/CmdNote.cs b/MCGalaxy/Modules/Moderation/Notes/CmdNote.cs index f7564589a..04cada34d 100644 --- a/MCGalaxy/Modules/Moderation/Notes/CmdNote.cs +++ b/MCGalaxy/Modules/Moderation/Notes/CmdNote.cs @@ -18,13 +18,16 @@ permissions and limitations under the Licenses. using MCGalaxy.Commands.Moderation; using MCGalaxy.Events; -namespace MCGalaxy.Modules.Moderation.Notes { - public class CmdNote : Command2 { +namespace MCGalaxy.Modules.Moderation.Notes +{ + public class CmdNote : Command2 + { public override string name { get { return "Note"; } } public override string type { get { return CommandTypes.Moderation; } } public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } } protected virtual bool announce { get { return true; } } protected virtual ModActionType modActionType { get { return ModActionType.Noted; } } + public override void Use(Player p, string message, CommandData data) { if (!Server.Config.LogNotes) { p.Message("Notes logging must be enabled to note players."); return; @@ -44,7 +47,7 @@ public override void Use(Player p, string message, CommandData data) { if (group == null) return; ModAction action = new ModAction(target, p, modActionType, note); - action.Announce = announce; + action.Announce = announce; OnModActionEvent.Call(action); } @@ -54,12 +57,14 @@ public override void Help(Player p) { p.Message("&HFor [text], @number can be used as a shortcut for that rule."); } } - public class CmdOpNote : CmdNote { + + public class CmdOpNote : CmdNote + { public override string name { get { return "OpNote"; } } public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } - protected override bool announce { get { return false; } } protected override ModActionType modActionType { get { return ModActionType.OpNoted; } } + public override void Help(Player p) { p.Message("&T/OpNote [player] [text]"); p.Message("&HAdds a note to [player]'s /notes that only ops may see."); diff --git a/MCGalaxy/Modules/Moderation/Notes/NotesPlugin.cs b/MCGalaxy/Modules/Moderation/Notes/NotesPlugin.cs index 02e545f40..835d414bb 100644 --- a/MCGalaxy/Modules/Moderation/Notes/NotesPlugin.cs +++ b/MCGalaxy/Modules/Moderation/Notes/NotesPlugin.cs @@ -62,6 +62,15 @@ static void AddNote(ModAction e, string type) { /// public class NoteAcronym { + public readonly string Acronym; + public readonly string Action; + + private NoteAcronym(string acronym, string action) { + Acronym = acronym; + Action = action; + } + + private readonly static NoteAcronym Warned = new NoteAcronym("W", "Warned"); private readonly static NoteAcronym Kicked = new NoteAcronym("K", "Kicked"); private readonly static NoteAcronym Muted = new NoteAcronym("M", "Muted"); @@ -101,13 +110,5 @@ public static string GetAction(string acronym) { } return acronym; } - - public readonly string Acronym; - public readonly string Action; - - private NoteAcronym(string acronym, string action) { - Acronym = acronym; - Action = action; - } } }