From e3d6177794223b15ff0924c34fa311a1b0b2c66f Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 2 Sep 2016 14:45:28 +1000 Subject: [PATCH] Fix /mi realm owner for /os maps when player's account ends with numbers and the server has + in account names disabled. --- Commands/Chat/CmdColor.cs | 2 +- Commands/Chat/CmdTColor.cs | 2 +- Commands/Information/CmdMapInfo.cs | 12 +++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Commands/Chat/CmdColor.cs b/Commands/Chat/CmdColor.cs index 5880efb4b..73cc3f28b 100644 --- a/Commands/Chat/CmdColor.cs +++ b/Commands/Chat/CmdColor.cs @@ -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); diff --git a/Commands/Chat/CmdTColor.cs b/Commands/Chat/CmdTColor.cs index 3c9270505..3056d4943 100644 --- a/Commands/Chat/CmdTColor.cs +++ b/Commands/Chat/CmdTColor.cs @@ -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); diff --git a/Commands/Information/CmdMapInfo.cs b/Commands/Information/CmdMapInfo.cs index abd5a19ee..5a9cafc6d 100644 --- a/Commands/Information/CmdMapInfo.cs +++ b/Commands/Information/CmdMapInfo.cs @@ -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 vWhitelist = data.VisitWhitelist, vBlacklist = data.VisitBlacklist; List 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); }