you can now use draw commands in zones that are less restrictive than map build permissions

This commit is contained in:
UnknownShadow200 2018-06-11 10:30:01 +10:00
parent 4407a37446
commit f7368a173c
2 changed files with 12 additions and 4 deletions

View File

@ -66,6 +66,7 @@ namespace MCGalaxy.Commands.Moderation {
Player.Message(p, "A zone with that name already exists. Use %T/zedit %Sto change it.");
return;
}
if (!LevelInfo.ValidateAction(p, args[0], "create zones in this level")) return;
Zone z = new Zone(p.level);
z.Config.Name = args[offset];

View File

@ -47,6 +47,16 @@ namespace MCGalaxy.Drawing.Ops {
return lvl;
}
static bool CannotBuildIn(Player p, Level lvl) {
Zone[] zones = lvl.Zones.Items;
for (int i = 0; i < zones.Length; i++) {
AccessResult access = zones[i].Access.Check(p);
// player could potentially modify blocks in this particular zone
if (access == AccessResult.Whitelisted || access == AccessResult.Allowed) return false;
}
return !lvl.BuildAccess.CheckDetailed(p);
}
public static bool Do(DrawOp op, Brush brush, Player p,
Vec3S32[] marks, bool checkLimit = true) {
Level lvl = Setup(op, p, marks);
@ -54,10 +64,7 @@ namespace MCGalaxy.Drawing.Ops {
Player.Message(p, "Drawing commands are turned off on this map.");
return false;
}
if (lvl != null && !lvl.BuildAccess.CheckDetailed(p)) {
Player.Message(p, "Hence you cannot use draw commands on this map.");
return false;
}
if (lvl != null && CannotBuildIn(p, lvl)) return false;
long affected = op.BlocksAffected(lvl, marks);
if (p != null && op.AffectedByTransform)