mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 20:16:36 -04:00
Optimise common case of zone permissions check returning true to be much faster
This commit is contained in:
parent
73d9fd14bb
commit
7ffef91aab
@ -199,7 +199,10 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
public override string shortcut { get { return "ZMark"; } }
|
||||
public override string type { get { return CommandTypes.Building; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("zm") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message.Length == 0) { Help(p); return; }
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MCGalaxy.Blocks;
|
||||
using MCGalaxy.Blocks.Physics;
|
||||
using MCGalaxy.DB;
|
||||
@ -206,8 +207,10 @@ namespace MCGalaxy {
|
||||
for (int i = 0; i < zones.Length; i++) {
|
||||
Zone zn = zones[i];
|
||||
if (x < zn.MinX || x > zn.MaxX || y < zn.MinY || y > zn.MaxY || z < zn.MinZ || z > zn.MaxZ) continue;
|
||||
AccessResult access = zn.Access.Check(p);
|
||||
if (access == AccessResult.Allowed || access == AccessResult.Whitelisted) return true;
|
||||
|
||||
ZoneConfig cfg = zn.Config;
|
||||
if (p.group.Permission >= cfg.BuildMin) return true;
|
||||
if (cfg.BuildWhitelist.Count > 0 && cfg.BuildWhitelist.CaselessContains(p.name)) return true;
|
||||
}
|
||||
|
||||
// Check zones denied from
|
||||
|
Loading…
x
Reference in New Issue
Block a user