From 7782cdb300f808e93b84445eb705ece039dde2ce Mon Sep 17 00:00:00 2001 From: Goodlyay Date: Fri, 8 Aug 2025 01:12:03 -0700 Subject: [PATCH] When doing /os go [name], allow partial matching --- MCGalaxy/Commands/Overseer.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/MCGalaxy/Commands/Overseer.cs b/MCGalaxy/Commands/Overseer.cs index 84309cf28..d43fd7069 100644 --- a/MCGalaxy/Commands/Overseer.cs +++ b/MCGalaxy/Commands/Overseer.cs @@ -207,9 +207,26 @@ namespace MCGalaxy.Commands.World { "&T/os go &H- Teleports you to your first map.", "&T/os go [num] &H- Teleports you to your nth map.", }; - static void HandleGoto(Player p, string map) { - map = GetLevelName(p, map); + static void HandleGoto(Player p, string message) { + string map = GetLevelName(p, message); + if (message.Length == 0) { + GotoExact(p, map); return; + } + + int mapNumber; + if (NumberUtils.TryParseInt32(message, out mapNumber)) { + //If it's a number, use exact goto logic like before + GotoExact(p, map); return; + } + + if (Formatter.ValidMapName(p, map)) { + //Allow partial match for going to renamed os map + //Works funky with level auto load off...? TOO BAD! No one should ever use that setting + PlayerActions.ChangeMap(p, map); + } + } + static void GotoExact(Player p, string map) { if (LevelInfo.FindExact(map) == null) LevelActions.Load(p, map, !Server.Config.AutoLoadMaps); if (LevelInfo.FindExact(map) != null)