mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
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:
parent
5c8edae438
commit
e3d6177794
@ -74,7 +74,7 @@ namespace MCGalaxy.Commands {
|
|||||||
} else {
|
} else {
|
||||||
string color = Colors.Parse(args[1]);
|
string color = Colors.Parse(args[1]);
|
||||||
if (color == "") { Player.Message(p, "There is no color \"" + args[1] + "\"."); return; }
|
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);
|
Player.SendChatFrom(who, who.ColoredName + " %Shad their color changed to " + color + Colors.Name(color) + "%S.", false);
|
||||||
who.color = color;
|
who.color = color;
|
||||||
Database.Execute("UPDATE Players SET color = @1 WHERE Name = @0", who.name, color);
|
Database.Execute("UPDATE Players SET color = @1 WHERE Name = @0", who.name, color);
|
||||||
|
@ -56,7 +56,7 @@ namespace MCGalaxy.Commands {
|
|||||||
} else {
|
} else {
|
||||||
string color = Colors.Parse(args[1]);
|
string color = Colors.Parse(args[1]);
|
||||||
if (color == "") { Player.Message(p, "There is no color \"" + args[1] + "\"."); return; }
|
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);
|
Player.SendChatFrom(who, who.ColoredName + " %Shad their title color changed to " + color + Colors.Name(color) + "%S.", false);
|
||||||
who.titlecolor = color;
|
who.titlecolor = color;
|
||||||
Database.Execute("UPDATE Players SET title_color = @1 WHERE Name = @0", who.name, color);
|
Database.Execute("UPDATE Players SET title_color = @1 WHERE Name = @0", who.name, color);
|
||||||
|
@ -90,7 +90,7 @@ namespace MCGalaxy.Commands {
|
|||||||
" %S: Visit rank = " + Group.findPerm(data.visit).ColoredName);
|
" %S: Visit rank = " + Group.findPerm(data.visit).ColoredName);
|
||||||
Player.Message(p, " BuildMax Rank = " + Group.findPerm(data.buildmax).ColoredName +
|
Player.Message(p, " BuildMax Rank = " + Group.findPerm(data.buildmax).ColoredName +
|
||||||
" %S: VisitMax Rank = " + Group.findPerm(data.visitmax).ColoredName);
|
" %S: VisitMax Rank = " + Group.findPerm(data.visitmax).ColoredName);
|
||||||
|
|
||||||
List<string> vWhitelist = data.VisitWhitelist, vBlacklist = data.VisitBlacklist;
|
List<string> vWhitelist = data.VisitWhitelist, vBlacklist = data.VisitBlacklist;
|
||||||
List<string> bWhitelist = data.BuildWhitelist, bBlacklist = data.BuildBlacklist;
|
List<string> bWhitelist = data.BuildWhitelist, bBlacklist = data.BuildBlacklist;
|
||||||
GetBlacklistedPlayers(data.Name, vBlacklist);
|
GetBlacklistedPlayers(data.Name, vBlacklist);
|
||||||
@ -112,11 +112,17 @@ namespace MCGalaxy.Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static string GetRealmMapOwner(string lvlName) {
|
static string GetRealmMapOwner(string lvlName) {
|
||||||
|
bool plus = Server.ClassicubeAccountPlus;
|
||||||
// Early out when accounts have + and map doesn't.
|
// 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);
|
lvlName = lvlName.Substring(0, lvlName.Length - 1);
|
||||||
|
}
|
||||||
return PlayerInfo.FindName(lvlName);
|
return PlayerInfo.FindName(lvlName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user