More case insensitive

This commit is contained in:
UnknownShadow200 2017-08-04 17:00:36 +10:00
parent baa7425a3d
commit b0fde8f95b
8 changed files with 11 additions and 12 deletions

View File

@ -174,7 +174,7 @@ namespace MCGalaxy {
public static bool NotIgnoring(Player source, Player target) {
if (target.ignoreAll) return source == target; // don't ignore messages from self
return source == null || !target.listignored.Contains(source.name);
return source == null || !target.listignored.CaselessContains(source.name);
}

View File

@ -97,7 +97,7 @@ namespace MCGalaxy {
if (who.ignoreAll) {
DoFakePM(p, who, message); return;
}
if (p != null && who.listignored.Contains(p.name)) {
if (p != null && who.listignored.CaselessContains(p.name)) {
DoFakePM(p, who, message); return;
}
DoPM(p, who, message);

View File

@ -81,10 +81,9 @@ namespace MCGalaxy.Commands.Chatting {
Player.Message(p, "You must use the full name when unignoring offline players.");
return;
}
if (p.name == who.name) { Player.Message(p, "You cannot ignore yourself."); return; }
if (p == who) { Player.Message(p, "You cannot ignore yourself."); return; }
if (p.listignored.Contains(who.name)) {
p.listignored.Remove(who.name);
if (p.listignored.CaselessRemove(who.name)) {
Player.Message(p, "&aNo longer ignoring {0}", who.ColoredName);
} else {
p.listignored.Add(who.name);

View File

@ -30,7 +30,7 @@ namespace MCGalaxy.Commands.Chatting {
if (!TryMessage(p, string.Format(message, giver, who.ColoredName))) return false;
string giverRaw = (p == null) ? "(console)" : p.name;
if (messageWho && !who.listignored.Contains(giverRaw) && !who.ignoreAll)
if (messageWho && !who.listignored.CaselessContains(giverRaw) && !who.ignoreAll)
Player.Message(who, string.Format(message, giver, "you"));
return true;
}

View File

@ -103,8 +103,8 @@ namespace MCGalaxy.Commands.Moderation {
}
static Group TargetRank(Player p, string name, Group curRank) {
if (name == "+up") return NextRankUp(p, curRank);
if (name == "-down") return NextRankDown(p, curRank);
if (name.CaselessEq("+up")) return NextRankUp(p, curRank);
if (name.CaselessEq("-down")) return NextRankDown(p, curRank);
return Matcher.FindRanks(p, name);
}

View File

@ -34,7 +34,7 @@ namespace MCGalaxy.Commands.World {
if (message.Length == 0) {
if (Player.IsSuper(p)) {
Player.Message(p, "Main level is {0}", Server.mainLevel.ColoredName);
} else if (p.level.name == Server.mainLevel.name) {
} else if (p.level == Server.mainLevel) {
Command.all.FindByName("Spawn").Use(p, "");
} else {
PlayerActions.ChangeMap(p, Server.mainLevel);

View File

@ -58,7 +58,7 @@ namespace MCGalaxy.Commands.World {
Player pl = PlayerInfo.FindMatches(p, name);
if (pl == null) return;
if (pl.level.name == p.level.name) {
if (pl.level == p.level) {
PlayerActions.ChangeMap(pl, Server.mainLevel);
} else {
Player.Message(p, "Player is not on your level!");

View File

@ -44,9 +44,9 @@ namespace MCGalaxy.Commands.Misc {
Player target = PlayerInfo.FindMatches(p, message);
if (target == null) return;
if (target == p) { Player.Message(p, "You cannot /tpa to yourself."); return; }
if (target.listignored.Contains(p.name)) { ShowSentMessage(p, target); return; }
if (target.listignored.CaselessContains(p.name)) { ShowSentMessage(p, target); return; }
if (target.name == p.currentTpa) {
if (target.name.CaselessEq(p.currentTpa)) {
Player.Message(p, "You still have a pending teleport request with this player."); return;
}
if (p.level != target.level && target.level.IsMuseum) {