Fix /notes not matching properly against own name

This commit is contained in:
UnknownShadow200 2017-04-19 17:01:33 +10:00
parent 73199aa8be
commit 77f5744314

View File

@ -29,14 +29,23 @@ namespace MCGalaxy.Commands {
if (!Server.LogNotes) {
Player.Message(p, "The server does not have notes logging enabled."); return;
}
if (CheckSuper(p, message, "player name")) return;
if (message == "") message = p.name;
string name = PlayerInfo.FindMatchesPreferOnline(p, message);
if (name == null) return;
List<string> notes = Server.Notes.FindMatches(p, message, "notes");
if (notes == null) return;
List<string> notes = new List<string>();
foreach (string note in Server.Notes.Find(name)) {
notes.Add(note);
}
string target = PlayerMetaList.GetName(notes[0]);
Player.Message(p, " Notes for {0}:", PlayerInfo.GetColoredName(p, target));
string target = PlayerInfo.GetColoredName(p, name);
if (notes.Count == 0) {
Player.Message(p, "{0} %Shas no notes.", target); return;
} else {
Player.Message(p, " Notes for {0}:", target);
}
foreach (string line in notes) {
string[] args = line.SplitSpaces();
@ -46,7 +55,7 @@ namespace MCGalaxy.Commands {
Player.Message(p, Action(args[1]) + " by " + args[2] + " on " + args[3]);
} else {
Player.Message(p, Action(args[1]) + " by " + args[2] + " on " + args[3]
+ " - " + args[4].Replace("%20", " "));
+ " - " + args[4].Replace("%20", " "));
}
}
}
@ -63,8 +72,8 @@ namespace MCGalaxy.Commands {
}
public override void Help(Player p) {
Player.Message(p, "%T/notes [name] %H- views that player's notes.");
Player.Message(p, "%HNotes are things such as bans, kicks, warns, mutes.");
Player.Message(p, "%T/notes [name] %H- views that player's notes.");
Player.Message(p, "%HNotes are things such as bans, kicks, warns, mutes.");
}
}