From 44e63db1bdd0c12b7ab90fdd6ee2f4b9dbb9fdb8 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 10 Aug 2017 17:44:21 +1000 Subject: [PATCH] Simplify CmdOverseer a tiny bit --- MCGalaxy/Commands/World/CmdOverseer.cs | 11 ++++------- MCGalaxy/util/Formatting/Matcher.cs | 4 +--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/MCGalaxy/Commands/World/CmdOverseer.cs b/MCGalaxy/Commands/World/CmdOverseer.cs index 183eb4d09..25e9957ec 100644 --- a/MCGalaxy/Commands/World/CmdOverseer.cs +++ b/MCGalaxy/Commands/World/CmdOverseer.cs @@ -97,16 +97,13 @@ namespace MCGalaxy.Commands.World { static string NextLevel(Player p) { string level = p.name.ToLower(); if (LevelInfo.MapExists(level) || LevelInfo.MapExists(level + "00")) { - for (int i = 2; i < p.group.OverseerMaps + 2; i++) { + // subtract 1, because we accounted for it in above if statement + for (int i = 2; i < (p.group.OverseerMaps - 1) + 2; i++) { if (LevelInfo.MapExists(p.name.ToLower() + i)) continue; - if(i > p.group.OverseerMaps) { - Player.Message(p, "You have reached the limit for your overseer maps."); return null; - } return p.name.ToLower() + i; } - if (level == p.name.ToLower()) { - Player.Message(p, "You have reached the limit for your overseer maps."); return null; - } + + Player.Message(p, "You have reached the limit for your overseer maps."); return null; } return level; } diff --git a/MCGalaxy/util/Formatting/Matcher.cs b/MCGalaxy/util/Formatting/Matcher.cs index 318f54cd5..fa9ddc722 100644 --- a/MCGalaxy/util/Formatting/Matcher.cs +++ b/MCGalaxy/util/Formatting/Matcher.cs @@ -73,9 +73,7 @@ namespace MCGalaxy { /// Find partial matches of 'name' against the list of ranks. public static Group FindRanks(Player p, string name) { - name = name.ToLower(); - Group.MapName(ref name); - + Group.MapName(ref name); int matches = 0; return Find(p, name, out matches, Group.GroupList, null, g => Colors.Strip(g.Name), "ranks");