void Delete(Client player, string[] cmd, int iarg) { if (player.Admin() == false) { throw new ErrorException("Disabled"); } WorldRegion region = player.Session.CurrentRegion; if (region == null) { throw new ErrorException("No region here"); } if (cmd.Length <= iarg) { throw new ShowHelpException(); //Need more arguments } RegionList regions = player.Session.World.Regions; string subdel = cmd [iarg].ToLowerInvariant(); switch (subdel) { case "single": DeleteSingle(region, regions); player.TellSystem(Chat.Purple, region.Name + " removed"); player.Session.CurrentRegion = null; break; case "recursive": DeleteRecursive(region); player.TellSystem(Chat.Purple, region.Name + " and subregions removed"); region.Deleted = true; player.Session.CurrentRegion = null; break; case "subonly": DeleteSubregions(region); player.TellSystem(Chat.Purple, "Subregions of " + region.Name + " removed"); break; default: throw new ShowHelpException(); } RegionLoader.Save(regions); //Update all players regions foreach (var p in PlayerList.List) { RegionCrossing.SetRegion(p.Session); } ScoreboardRegionManager.UpdateAllPlayersRegion(); }
void AddResident(Client player, string[] cmd, int iarg) { WorldRegion region = player.Session.CurrentRegion; if (region == null) { throw new ErrorException("No region here"); } if (cmd.Length != 3) { throw new ErrorException("Too few arguments"); } region.AddPlayer(player, cmd [2]); ScoreboardRegionManager.UpdateAllPlayersRegion(); return; }
void Rename(Client player, string[] cmd, int iarg) { WorldRegion region = player.Session.CurrentRegion; if (region == null) { throw new ErrorException("No region here"); } if (cmd.Length < 3) { throw new ErrorException("Too few arguments"); } region.Rename(player, cmd.JoinFrom(2)); ScoreboardRegionManager.UpdateAllPlayersRegion(); }
void Type(Client player, string[] cmd, int iarg) { WorldRegion region = player.Session.CurrentRegion; if (region == null) { throw new ErrorException("No region here"); } if (cmd.Length == 2) { player.TellSystem(Chat.Purple, "Region is of type " + region.Type); return; } region.SetType(player, cmd.JoinFrom(2)); ScoreboardRegionManager.UpdateAllPlayersRegion(); return; }
void Resize(Client player, string[] cmd, int iarg) { WorldRegion region = player.Session.CurrentRegion; if (region == null) { throw new ErrorException("No region here"); } player.TellSystem(Chat.Gray, "Resizing: " + region); if (cmd.Length != 8) { throw new ShowHelpException(); } region.Resize(int.Parse(cmd [2]), int.Parse(cmd [3]), int.Parse(cmd [4]), int.Parse(cmd [5]), int.Parse(cmd [6]), int.Parse(cmd [7]), player); ScoreboardRegionManager.UpdateAllPlayersRegion(); }