Also log and show duration of action in /notes

This commit is contained in:
UnknownShadow200 2020-05-21 19:43:22 +10:00
parent d2619bdfb1
commit 659c25eee0
2 changed files with 10 additions and 10 deletions

View File

@ -48,12 +48,14 @@ namespace MCGalaxy.Commands.Moderation {
string[] args = line.SplitSpaces(); string[] args = line.SplitSpaces();
if (args.Length <= 3) continue; if (args.Length <= 3) continue;
if (args.Length == 4) { string reason = args.Length > 4 ? args[4] : "";
p.Message(Action(args[1]) + " by " + args[2] + " on " + args[3]); long duration = 0;
} else { if (args.Length > 5) long.TryParse(args[5], out duration);
p.Message(Action(args[1]) + " by " + args[2] + " on " + args[3]
+ " - " + args[4].Replace("%20", " ")); p.Message("{0} by {1} %Son {2}{3}{4}",
} Action(args[1]), PlayerInfo.GetColoredName(p, args[2]), args[3],
duration == 0 ? "" : " for " + TimeSpan.FromTicks(duration).Shorten(true),
reason.Length == 0 ? "" : " - " + reason.Replace("%20", " "));
} }
} }

View File

@ -54,10 +54,8 @@ namespace MCGalaxy.Core {
string src = e.Actor.name; string src = e.Actor.name;
string time = DateTime.UtcNow.ToString("dd/MM/yyyy"); string time = DateTime.UtcNow.ToString("dd/MM/yyyy");
string data = e.Target + " " + type + " " + src + " " + time; string data = e.Target + " " + type + " " + src + " " + time + " " +
if (e.Reason.Length > 0) { e.Reason.Replace(" ", "%20") + " " + e.Duration.Ticks;
data += " " + e.Reason.Replace(" ", "%20");
}
Server.Notes.Append(data); Server.Notes.Append(data);
} }
} }