diff --git a/MCGalaxy/Commands/Information/CmdMapInfo.cs b/MCGalaxy/Commands/Information/CmdMapInfo.cs index ad5787ad1..27496f209 100644 --- a/MCGalaxy/Commands/Information/CmdMapInfo.cs +++ b/MCGalaxy/Commands/Information/CmdMapInfo.cs @@ -184,7 +184,7 @@ namespace MCGalaxy.Commands.Info { public ushort Width, Height, Length; public string Name, MapName; public long BlockDBEntries = -1; - public LevelAccessController Visit, Build; + public AccessController Visit, Build; public LevelConfig Config; public void FromLevel(Level lvl) { diff --git a/MCGalaxy/Levels/AccessController.cs b/MCGalaxy/Levels/AccessController.cs index 0a68c0a1d..01a866d21 100644 --- a/MCGalaxy/Levels/AccessController.cs +++ b/MCGalaxy/Levels/AccessController.cs @@ -27,7 +27,9 @@ namespace MCGalaxy { public abstract LevelPermission Min { get; set; } public abstract LevelPermission Max { get; set; } + /// List of players who are always allowed to access. public abstract List Whitelisted { get; } + /// List of players who are never allowd to access. public abstract List Blacklisted { get; } protected abstract string ColoredName { get; } @@ -202,47 +204,46 @@ namespace MCGalaxy { } /// Encapuslates access permissions (visit or build) for a level. - public sealed class LevelAccessController : AccessController { - - public readonly bool IsVisit; + public sealed class LevelAccessController : AccessController { + readonly bool isVisit; readonly LevelConfig cfg; readonly string lvlName; public LevelAccessController(LevelConfig cfg, string levelName, bool isVisit) { this.cfg = cfg; this.lvlName = levelName; - IsVisit = isVisit; + this.isVisit = isVisit; } public override LevelPermission Min { - get { return IsVisit ? cfg.VisitMin : cfg.BuildMin; } + get { return isVisit ? cfg.VisitMin : cfg.BuildMin; } set { - if (IsVisit) cfg.VisitMin = value; + if (isVisit) cfg.VisitMin = value; else cfg.BuildMin = value; } } public override LevelPermission Max { - get { return IsVisit ? cfg.VisitMax : cfg.BuildMax; } + get { return isVisit ? cfg.VisitMax : cfg.BuildMax; } set { - if (IsVisit) cfg.VisitMax = value; + if (isVisit) cfg.VisitMax = value; else cfg.BuildMax = value; } } public override List Whitelisted { - get { return IsVisit ? cfg.VisitWhitelist : cfg.BuildWhitelist; } + get { return isVisit ? cfg.VisitWhitelist : cfg.BuildWhitelist; } } public override List Blacklisted { - get { return IsVisit ? cfg.VisitBlacklist : cfg.BuildBlacklist; } + get { return isVisit ? cfg.VisitBlacklist : cfg.BuildBlacklist; } } protected override string ColoredName { get { return cfg.Color + lvlName; } } - protected override string Action { get { return IsVisit ? "go to" : "build in"; } } - protected override string ActionIng { get { return IsVisit ? "going to" : "building in"; } } - protected override string Type { get { return IsVisit ? "visit" : "build"; } } - protected override string MaxCmd { get { return IsVisit ? "PerVisit" : "PerBuild"; } } + protected override string Action { get { return isVisit ? "go to" : "build in"; } } + protected override string ActionIng { get { return isVisit ? "going to" : "building in"; } } + protected override string Type { get { return isVisit ? "visit" : "build"; } } + protected override string MaxCmd { get { return isVisit ? "PerVisit" : "PerBuild"; } } protected override void ApplyChanges(Player p, Level lvl, string msg) { @@ -258,14 +259,14 @@ namespace MCGalaxy { void Update(Level lvl) { cfg.SaveFor(lvlName); if (lvl == null) return; - if (IsVisit && lvl == Server.mainLevel) return; + if (isVisit && lvl == Server.mainLevel) return; Player[] players = PlayerInfo.Online.Items; foreach (Player p in players) { if (p.level != lvl) continue; bool allowed = CheckAllowed(p); - if (!IsVisit) { + if (!isVisit) { p.AllowBuild = allowed; } else if (!allowed) { p.Message("%WNo longer allowed to visit %S{0}", ColoredName); diff --git a/MCGalaxy/Levels/LevelConfig.cs b/MCGalaxy/Levels/LevelConfig.cs index 9db038a93..0ca53290d 100644 --- a/MCGalaxy/Levels/LevelConfig.cs +++ b/MCGalaxy/Levels/LevelConfig.cs @@ -271,8 +271,6 @@ namespace MCGalaxy { [ConfigTimespan("MinRoundTime", "Game", 4, true)] public TimeSpan RoundTime = TimeSpan.FromMinutes(5); - [ConfigTimespan("MaxRoundTime", "Game", 7, true)] - public TimeSpan __MaxRoundTime = TimeSpan.FromMinutes(7); [ConfigBool("DrawingAllowed", "Game", true)] public bool Drawing = true; [ConfigInt("RoundsPlayed", "Game", 0)] diff --git a/MCGalaxy/Levels/LevelInfo.cs b/MCGalaxy/Levels/LevelInfo.cs index a34853b3f..950b319dc 100644 --- a/MCGalaxy/Levels/LevelInfo.cs +++ b/MCGalaxy/Levels/LevelInfo.cs @@ -137,8 +137,8 @@ namespace MCGalaxy { Level lvl; LevelConfig cfg = GetConfig(map, out lvl); if (lvl != null) return Check(p, plRank, lvl, action); - LevelAccessController visit = new LevelAccessController(cfg, map, true); - LevelAccessController build = new LevelAccessController(cfg, map, false); + AccessController visit = new LevelAccessController(cfg, map, true); + AccessController build = new LevelAccessController(cfg, map, false); if (!visit.CheckDetailed(p, plRank) || !build.CheckDetailed(p, plRank)) { p.Message("Hence, you cannot {0}.", action); return false; } diff --git a/MCGalaxy/Player/PlayerActions.cs b/MCGalaxy/Player/PlayerActions.cs index 5aea3c49e..f4131d3bb 100644 --- a/MCGalaxy/Player/PlayerActions.cs +++ b/MCGalaxy/Player/PlayerActions.cs @@ -79,7 +79,7 @@ namespace MCGalaxy { return false; } - LevelAccessController visitAccess = new LevelAccessController(cfg, map, true); + AccessController visitAccess = new LevelAccessController(cfg, map, true); bool skip = p.summonedMap != null && p.summonedMap.CaselessEq(map); LevelPermission plRank = skip ? LevelPermission.Nobody : p.Rank; if (!visitAccess.CheckDetailed(p, plRank)) return false;