diff --git a/MCGalaxy/Levels/LevelOptions.cs b/MCGalaxy/Levels/LevelOptions.cs index 1f3c6cd69..6de63ad74 100644 --- a/MCGalaxy/Levels/LevelOptions.cs +++ b/MCGalaxy/Levels/LevelOptions.cs @@ -102,9 +102,23 @@ namespace MCGalaxy { } static void SetOwner(Player p, Level lvl, string value) { - lvl.Config.RealmOwner = value.Replace(", ", ",").Replace(" ", ","); - if (value.Length == 0) p.Message("Removed realm owner for this level."); - else p.Message("Set realm owner/owners of this level to {0}.", value); + if (value.Length == 0) { + lvl.Config.RealmOwner = ""; + p.Message("Removed realm owner for this level."); + return; + } + + value = value.Replace(", ", ","); + value = value.Replace(",", " "); + + string[] names = value.SplitSpaces(); + for (int i = 0; i < names.Length; i++) { + names[i] = PlayerInfo.FindMatchesPreferOnline(p, names[i]); + if (names[i] == null) return; + } + + lvl.Config.RealmOwner = names.Join(","); ; + p.Message("Set realm owner/owners of this level to {0}.", names.Join((n) => p.FormatNick(n))); } static void SetTree(Player p, Level lvl, string value) { diff --git a/MCGalaxy/Player/PlayerInfo.cs b/MCGalaxy/Player/PlayerInfo.cs index 3d8d6fbbf..5db9cd848 100644 --- a/MCGalaxy/Player/PlayerInfo.cs +++ b/MCGalaxy/Player/PlayerInfo.cs @@ -71,7 +71,12 @@ namespace MCGalaxy return Matcher.Find(pl, name, out matches, Online.Items, p => pl.CanSee(p), p => p.name, p => p.color + p.name, "online players"); } - + + /// + /// Matches given name against the names of all online players that the given player can see. + /// If no online player is matched, attempts to find an offline player name match. + /// + /// A player name if exactly one found. Otherwise, null. public static string FindMatchesPreferOnline(Player p, string name) { if (!Formatter.ValidPlayerName(p, name)) return null; int matches;