diff --git a/MCGalaxy/Commands/Overseer.cs b/MCGalaxy/Commands/Overseer.cs index 7b145747e..84309cf28 100644 --- a/MCGalaxy/Commands/Overseer.cs +++ b/MCGalaxy/Commands/Overseer.cs @@ -443,6 +443,9 @@ namespace MCGalaxy.Commands.World { "&H With , renames to 'yourname[name]'.", }; static void HandleRename(Player p, string args) { + if (args.Length > 0 && !Formatter.IsValidName(p, args, "os name", Player.USERNAME_ALPHABET)) { + return; + } UseCommand(p, "RenameLvl", p.level.name + " " + GetLevelName(p, args)); } diff --git a/MCGalaxy/util/Formatting/Formatter.cs b/MCGalaxy/util/Formatting/Formatter.cs index 21311f98f..015650eaf 100644 --- a/MCGalaxy/util/Formatting/Formatter.cs +++ b/MCGalaxy/util/Formatting/Formatter.cs @@ -90,7 +90,7 @@ namespace MCGalaxy return IsValidName(p, name, "player", alphabet); } - static bool IsValidName(Player p, string name, string type, string alphabet) { + public static bool IsValidName(Player p, string name, string type, string alphabet) { if (name.Length > 0 && name.ContainsAllIn(alphabet)) return true; p.Message("\"{0}\" is not a valid {1} name.", name, type); return false;