diff --git a/MCGalaxy/Commands/CommandParser.cs b/MCGalaxy/Commands/CommandParser.cs
index c5499e0e9..0774b3bdb 100644
--- a/MCGalaxy/Commands/CommandParser.cs
+++ b/MCGalaxy/Commands/CommandParser.cs
@@ -202,6 +202,7 @@ namespace MCGalaxy.Commands {
/// Attempts to parse the given argument as either a block name or a block ID.
/// Also ensures the player is allowed to place the given block.
+ [Obsolete("Use GetBlockIfAllowed with explicit action argument instead")]
public static bool GetBlockIfAllowed(Player p, string input, out BlockID block, bool allowSkip = false) {
return GetBlockIfAllowed(p, input, "draw with", out block, allowSkip);
}
diff --git a/MCGalaxy/Commands/Moderation/CmdPass.cs b/MCGalaxy/Commands/Moderation/CmdPass.cs
index e94510a42..c5d5794be 100644
--- a/MCGalaxy/Commands/Moderation/CmdPass.cs
+++ b/MCGalaxy/Commands/Moderation/CmdPass.cs
@@ -103,7 +103,7 @@ namespace MCGalaxy.Commands.Moderation {
}
bool CheckResetPerms(Player p, CommandData data) {
- // check server owner name for backwards compatibility
+ // check server owner name for permissions backwards compatibility
return Server.Config.OwnerName.CaselessEq(p.name) || CheckExtraPerm(p, data, 1);
}
diff --git a/MCGalaxy/Commands/building/CmdOutline.cs b/MCGalaxy/Commands/building/CmdOutline.cs
index 6d872d9ba..274eb00ca 100644
--- a/MCGalaxy/Commands/building/CmdOutline.cs
+++ b/MCGalaxy/Commands/building/CmdOutline.cs
@@ -26,13 +26,14 @@ namespace MCGalaxy.Commands.Building {
public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
protected override DrawOp GetDrawOp(DrawArgs dArgs) {
+ Player p = dArgs.Player;
if (dArgs.Message.Length == 0) {
- dArgs.Player.Message("Block name is required."); return null;
+ p.Message("Block name is required."); return null;
}
BlockID target;
string[] parts = dArgs.Message.SplitSpaces(2);
- if (!CommandParser.GetBlockIfAllowed(dArgs.Player, parts[0], out target)) return null;
+ if (!CommandParser.GetBlockIfAllowed(p, parts[0], "draw with", out target)) return null;
OutlineDrawOp op = new OutlineDrawOp();
// e.g. testing air 'above' grass - therefore op.Above needs to be false for 'up mode'
diff --git a/MCGalaxy/Commands/building/CmdReplaceBrush.cs b/MCGalaxy/Commands/building/CmdReplaceBrush.cs
index 6c46410b9..fa766ee64 100644
--- a/MCGalaxy/Commands/building/CmdReplaceBrush.cs
+++ b/MCGalaxy/Commands/building/CmdReplaceBrush.cs
@@ -40,7 +40,7 @@ namespace MCGalaxy.Commands.Building {
BlockID target;
- if (!CommandParser.GetBlockIfAllowed(p, args[0], out target)) return null;
+ if (!CommandParser.GetBlockIfAllowed(p, args[0], "draw with", out target)) return null;
BrushFactory factory = BrushFactory.Find(args[1]);
if (factory == null) {
diff --git a/MCGalaxy/Database/BlockDB/BlockDBEntry.cs b/MCGalaxy/Database/BlockDB/BlockDBEntry.cs
index 50cc53c84..51203f945 100644
--- a/MCGalaxy/Database/BlockDB/BlockDBEntry.cs
+++ b/MCGalaxy/Database/BlockDB/BlockDBEntry.cs
@@ -80,11 +80,11 @@ namespace MCGalaxy.DB {
public const ushort Restored = 1 << 7;
public const ushort UndoOther = 1 << 8;
public const ushort UndoSelf = 1 << 9;
- public const ushort RedoSelf = 1 << 10;
+ public const ushort RedoSelf = 1 << 10;
public const ushort FixGrass = 1 << 11;
public const ushort OldExtended2 = 1 << 12;
- public const ushort NewExtended2 = 1 << 13;
+ public const ushort NewExtended2 = 1 << 13;
public const ushort OldExtended = 1 << 14;
public const ushort NewExtended = 1 << 15;
}
diff --git a/MCGalaxy/Drawing/BrushFactories/FrequencyBrushes.cs b/MCGalaxy/Drawing/BrushFactories/FrequencyBrushes.cs
index 09494ee0e..768035964 100644
--- a/MCGalaxy/Drawing/BrushFactories/FrequencyBrushes.cs
+++ b/MCGalaxy/Drawing/BrushFactories/FrequencyBrushes.cs
@@ -46,7 +46,7 @@ namespace MCGalaxy.Drawing.Brushes
int sepIndex = parts[i].IndexOf('/');
string arg = sepIndex >= 0 ? parts[i].Substring(0, sepIndex) : parts[i];
- if (!CommandParser.GetBlockIfAllowed(p, arg, out blocks[j], true)) return null;
+ if (!CommandParser.GetBlockIfAllowed(p, arg, "draw with", out blocks[j], true)) return null;
if (sepIndex >= 0) {
arg = parts[i].Substring(sepIndex + 1);
diff --git a/MCGalaxy/Drawing/BrushFactories/ReplaceBrushes.cs b/MCGalaxy/Drawing/BrushFactories/ReplaceBrushes.cs
index c10e28afc..7514785ad 100644
--- a/MCGalaxy/Drawing/BrushFactories/ReplaceBrushes.cs
+++ b/MCGalaxy/Drawing/BrushFactories/ReplaceBrushes.cs
@@ -56,23 +56,25 @@ namespace MCGalaxy.Drawing.Brushes
for (int i = 0; i < blocks.Length; i++)
blocks[i] = Block.Invalid;
- for (int i = 0; start < max; start++, i++ ) {
+ for (int i = 0; start < max; start++, i++)
+ {
BlockID block;
- if (!CommandParser.GetBlockIfAllowed(p, parts[start], out block)) return null;
-
+ if (!CommandParser.GetBlockIfAllowed(p, parts[start], "draw with", out block)) return null;
blocks[i] = block;
}
return blocks;
}
static bool GetTargetBlock(BrushArgs args, string[] parts, out BlockID target) {
+ Player p = args.Player;
target = 0;
+
if (parts.Length == 1) {
- if (!CommandParser.IsBlockAllowed(args.Player, "draw with", args.Block)) return false;
+ if (!CommandParser.IsBlockAllowed(p, "draw with", args.Block)) return false;
target = args.Block; return true;
}
- return CommandParser.GetBlockIfAllowed(args.Player, parts[parts.Length - 1], out target);
+ return CommandParser.GetBlockIfAllowed(p, parts[parts.Length - 1], "draw with", out target);
}
}
diff --git a/MCGalaxy/Drawing/BrushFactories/SimpleBrushes.cs b/MCGalaxy/Drawing/BrushFactories/SimpleBrushes.cs
index 0bf955ee7..63bcb14dc 100644
--- a/MCGalaxy/Drawing/BrushFactories/SimpleBrushes.cs
+++ b/MCGalaxy/Drawing/BrushFactories/SimpleBrushes.cs
@@ -33,20 +33,21 @@ namespace MCGalaxy.Drawing.Brushes
};
public override Brush Construct(BrushArgs args) {
+ Player p = args.Player;
if (args.Message.Length == 0) {
- if (!CommandParser.IsBlockAllowed(args.Player, "draw with", args.Block)) return null;
+ if (!CommandParser.IsBlockAllowed(p, "draw with", args.Block)) return null;
return new SolidBrush(args.Block);
}
BlockID block;
- if (!CommandParser.GetBlockIfAllowed(args.Player, args.Message, out block)) return null;
+ if (!CommandParser.GetBlockIfAllowed(p, args.Message, "draw with", out block)) return null;
return new SolidBrush(block);
}
public override bool Validate(BrushArgs args) {
if (args.Message.Length == 0) return true;
BlockID block;
- return CommandParser.GetBlockIfAllowed(args.Player, args.Message, out block);
+ return CommandParser.GetBlockIfAllowed(args.Player, args.Message, "draw with", out block);
}
}
@@ -63,26 +64,27 @@ namespace MCGalaxy.Drawing.Brushes
};
public override Brush Construct(BrushArgs args) {
+ Player p = args.Player;
if (args.Message.Length == 0) {
- if (!CommandParser.IsBlockAllowed(args.Player, "draw with", args.Block)) return null;
+ if (!CommandParser.IsBlockAllowed(p, "draw with", args.Block)) return null;
return new CheckeredBrush(args.Block, Block.Invalid);
}
string[] parts = args.Message.SplitSpaces();
BlockID block1;
- if (!CommandParser.GetBlockIfAllowed(args.Player, parts[0], out block1, true)) return null;
+ if (!CommandParser.GetBlockIfAllowed(p, parts[0], "draw with", out block1, true)) return null;
if (parts.Length == 1)
return new CheckeredBrush(block1, Block.Invalid);
if (parts.Length == 2) {
BlockID block2;
- if (!CommandParser.GetBlockIfAllowed(args.Player, parts[1], out block2, true)) return null;
+ if (!CommandParser.GetBlockIfAllowed(p, parts[1], "draw with", out block2, true)) return null;
return new CheckeredBrush(block1, block2);
}
BlockID[] blocks = new BlockID[parts.Length];
for (int i = 0; i < blocks.Length; i++) {
- if (!CommandParser.GetBlockIfAllowed(args.Player, parts[i], out blocks[i], true)) return null;
+ if (!CommandParser.GetBlockIfAllowed(p, parts[i], "draw with", out blocks[i], true)) return null;
}
return new CheckeredPaletteBrush(blocks);
}
@@ -138,19 +140,20 @@ namespace MCGalaxy.Drawing.Brushes
};
public override Brush Construct(BrushArgs args) {
+ Player p = args.Player;
if (args.Message.Length == 0) {
- if (!CommandParser.IsBlockAllowed(args.Player, "draw with", args.Block)) return null;
+ if (!CommandParser.IsBlockAllowed(p, "draw with", args.Block)) return null;
return new StripedBrush(args.Block, Block.Air);
}
string[] parts = args.Message.SplitSpaces();
BlockID block1;
- if (!CommandParser.GetBlockIfAllowed(args.Player, parts[0], out block1, true)) return null;
+ if (!CommandParser.GetBlockIfAllowed(p, parts[0], "draw with", out block1, true)) return null;
if (parts.Length == 1)
return new StripedBrush(block1, Block.Air);
BlockID block2;
- if (!CommandParser.GetBlockIfAllowed(args.Player, parts[1], out block2, true)) return null;
+ if (!CommandParser.GetBlockIfAllowed(p, parts[1], "draw with", out block2, true)) return null;
return new StripedBrush(block1, block2);
}
}
diff --git a/MCGalaxy/Drawing/DrawOps/DrawOp.cs b/MCGalaxy/Drawing/DrawOps/DrawOp.cs
index 19d7a8e3f..4396065a6 100644
--- a/MCGalaxy/Drawing/DrawOps/DrawOp.cs
+++ b/MCGalaxy/Drawing/DrawOps/DrawOp.cs
@@ -40,26 +40,26 @@ namespace MCGalaxy.Drawing.Ops
//public long TotalAffected; // blocks affected by the draw operation
public long TotalModified; // blocks actually modified (e.g. some may not be due to permissions)
- /// Minimum coordinates of the bounds of this drawing command.
+ /// Minimum coordinates of the bounds of this draw operation
public Vec3S32 Min;
- /// Maximum coordinates of the bounds of this drawing command.
+ /// Maximum coordinates of the bounds of this draw operation
public Vec3S32 Max;
- /// Coordinates of the first point selected by the user.
+ /// Coordinates of the first point selected by the player
public Vec3S32 Origin;
- /// Coordinates of the current block being processed by the drawing command.
+ /// Coordinates of the current block being processed by this draw operation
/// Note: You should treat this as coordinates, it is a DrawOpBlock struct for performance reasons.
public DrawOpBlock Coords;
- /// Player that is executing the draw operation.
+ /// Player that is executing this draw operation
public Player Player;
- /// Level the draw operation is being performed upon.
+ /// Level that this draw operation is being performed on
public Level Level;
- /// BlockDB change flags for blocks affected by this draw operation.
+ /// BlockDB change flags for blocks affected by this draw operation
public ushort Flags = BlockDBFlags.Drawn;
/// Lock held on the associated level's BlockDB. Can be null.
@@ -78,8 +78,8 @@ namespace MCGalaxy.Drawing.Ops
/// Whether the output of this draw operation is affected by the player's current Transform.
public bool AffectedByTransform = true;
- /// Estimates the total number of blocks that the drawing commands affects.
- /// Note that this estimate assumes that all possibly affected blocks will be changed by the drawing command.
+ /// Estimates the total number of blocks that this draw operation may affect.
+ /// This estimate assumes that all potentially affected blocks will be changed by the draw operation
public abstract long BlocksAffected(Level lvl, Vec3S32[] marks);
public abstract void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output);