Lockdown autocompletes maps. Also fix help of /os go (Thanks VenkSociety)

This commit is contained in:
UnknownShadow200 2018-07-08 13:46:39 +10:00
parent 03c024d942
commit f559e38fef
3 changed files with 16 additions and 12 deletions

View File

@ -29,19 +29,23 @@ namespace MCGalaxy.Commands.World {
get { return new[] { new CommandAlias("WLock"), new CommandAlias("WUnlock") }; }
}
public override void Use(Player p, string message) {
if (message.Length == 0) { Help(p); return; }
if (!Formatter.ValidName(p, message, "level")) return;
public override void Use(Player p, string map) {
if (map.Length == 0) { Help(p); return; }
if (!Formatter.ValidName(p, map, "level")) return;
bool unlocking = Server.lockdown.Contains(message);
Chat.MessageGlobal("The map {0} has been {1}locked", message, unlocking ? "un" : "");
map = Matcher.FindMaps(p, map);
if (map == null) return;
bool unlocking = Server.lockdown.Contains(map);
string action = unlocking ? "unlocked" : "locked";
Chat.MessageGlobal("Map " + map + " was " + action);
if (unlocking) {
Server.lockdown.Remove(message);
Chat.MessageFromOps(p, "Map unlocked by: λNICK");
Server.lockdown.Remove(map);
Chat.MessageFromOps(p, "Map " + map + " unlocked by: λNICK");
} else {
Server.lockdown.AddIfNotExists(message);
Chat.MessageFromOps(p, "Map locked by: λNICK");
Server.lockdown.AddIfNotExists(map);
Chat.MessageFromOps(p, "Map " + map + " locked by: λNICK");
}
Server.lockdown.Save();
}

View File

@ -144,8 +144,8 @@ namespace MCGalaxy.Commands.World {
};
static string[] gotoHelp = new string[] {
"%T/os goto %H- Teleports you to your first map.",
"%T/os goto [num] %H- Teleports you to your nth map.",
"%T/os go %H- Teleports you to your first map.",
"%T/os go [num] %H- Teleports you to your nth map.",
};
static string[] kickHelp = new string[] {