Fix /mi realm owner for /os maps when player's account ends with numbers and the server has + in account names disabled.

This commit is contained in:
UnknownShadow200 2016-09-02 14:45:28 +10:00
parent 5c8edae438
commit e3d6177794
3 changed files with 11 additions and 5 deletions

View File

@ -74,7 +74,7 @@ namespace MCGalaxy.Commands {
} else {
string color = Colors.Parse(args[1]);
if (color == "") { Player.Message(p, "There is no color \"" + args[1] + "\"."); return; }
else if (color == who.color) { Player.Message(p, who.DisplayName + " already has that color."); return; }
else if (color == who.color) { Player.Message(p, who.DisplayName + " %Salready has that color."); return; }
Player.SendChatFrom(who, who.ColoredName + " %Shad their color changed to " + color + Colors.Name(color) + "%S.", false);
who.color = color;
Database.Execute("UPDATE Players SET color = @1 WHERE Name = @0", who.name, color);

View File

@ -56,7 +56,7 @@ namespace MCGalaxy.Commands {
} else {
string color = Colors.Parse(args[1]);
if (color == "") { Player.Message(p, "There is no color \"" + args[1] + "\"."); return; }
else if (color == who.titlecolor) { Player.Message(p, who.DisplayName + " already has that title color."); return; }
else if (color == who.titlecolor) { Player.Message(p, who.DisplayName + " %Salready has that title color."); return; }
Player.SendChatFrom(who, who.ColoredName + " %Shad their title color changed to " + color + Colors.Name(color) + "%S.", false);
who.titlecolor = color;
Database.Execute("UPDATE Players SET title_color = @1 WHERE Name = @0", who.name, color);

View File

@ -90,7 +90,7 @@ namespace MCGalaxy.Commands {
" %S: Visit rank = " + Group.findPerm(data.visit).ColoredName);
Player.Message(p, " BuildMax Rank = " + Group.findPerm(data.buildmax).ColoredName +
" %S: VisitMax Rank = " + Group.findPerm(data.visitmax).ColoredName);
List<string> vWhitelist = data.VisitWhitelist, vBlacklist = data.VisitBlacklist;
List<string> bWhitelist = data.BuildWhitelist, bBlacklist = data.BuildBlacklist;
GetBlacklistedPlayers(data.Name, vBlacklist);
@ -112,11 +112,17 @@ namespace MCGalaxy.Commands {
}
static string GetRealmMapOwner(string lvlName) {
bool plus = Server.ClassicubeAccountPlus;
// Early out when accounts have + and map doesn't.
if (Server.ClassicubeAccountPlus && lvlName.IndexOf('+') == -1) return null;
if (plus && lvlName.IndexOf('+') == -1) return null;
while (lvlName != "" && Char.IsNumber(lvlName[lvlName.Length - 1]))
while (lvlName != "" && Char.IsNumber(lvlName[lvlName.Length - 1])) {
// If the server does not have account with +, we have to account for the
// that say Player123's second level is Player1232, and the realm owner is Player123
string pName = plus ? null : PlayerInfo.FindName(lvlName);
if (pName != null) return pName;
lvlName = lvlName.Substring(0, lvlName.Length - 1);
}
return PlayerInfo.FindName(lvlName);
}