mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -04:00
you can now use draw commands in zones that are less restrictive than map build permissions
This commit is contained in:
parent
4407a37446
commit
f7368a173c
@ -66,6 +66,7 @@ namespace MCGalaxy.Commands.Moderation {
|
|||||||
Player.Message(p, "A zone with that name already exists. Use %T/zedit %Sto change it.");
|
Player.Message(p, "A zone with that name already exists. Use %T/zedit %Sto change it.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!LevelInfo.ValidateAction(p, args[0], "create zones in this level")) return;
|
||||||
|
|
||||||
Zone z = new Zone(p.level);
|
Zone z = new Zone(p.level);
|
||||||
z.Config.Name = args[offset];
|
z.Config.Name = args[offset];
|
||||||
|
@ -47,6 +47,16 @@ namespace MCGalaxy.Drawing.Ops {
|
|||||||
return lvl;
|
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,
|
public static bool Do(DrawOp op, Brush brush, Player p,
|
||||||
Vec3S32[] marks, bool checkLimit = true) {
|
Vec3S32[] marks, bool checkLimit = true) {
|
||||||
Level lvl = Setup(op, p, marks);
|
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.");
|
Player.Message(p, "Drawing commands are turned off on this map.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (lvl != null && !lvl.BuildAccess.CheckDetailed(p)) {
|
if (lvl != null && CannotBuildIn(p, lvl)) return false;
|
||||||
Player.Message(p, "Hence you cannot use draw commands on this map.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
long affected = op.BlocksAffected(lvl, marks);
|
long affected = op.BlocksAffected(lvl, marks);
|
||||||
if (p != null && op.AffectedByTransform)
|
if (p != null && op.AffectedByTransform)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user