From 2b5f0406af8b0773df966cd6d29ffe8c362fd893 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 24 Jul 2017 21:45:14 +1000 Subject: [PATCH] ReplaceAll should only count blocks actually being replaced, since otherwise it's useless for majority of maps. (Thanks dzidq) --- GUI/PropertyWindow/PropertyWindow.Ranks.cs | 4 +- MCGalaxy/Commands/Information/CmdHelp.cs | 2 +- MCGalaxy/Commands/Maintenance/CmdLimit.cs | 2 +- MCGalaxy/Commands/building/CmdCopy.cs | 4 +- MCGalaxy/Commands/building/CmdDrill.cs | 4 +- MCGalaxy/Commands/building/CmdFill.cs | 2 +- MCGalaxy/Commands/building/CmdReplaceAll.cs | 81 +++++++++++++++++++ MCGalaxy/Commands/building/ReplaceCmd.cs | 30 ------- MCGalaxy/Drawing/DrawOps/CuboidDrawOp.cs | 2 +- MCGalaxy/Drawing/DrawOps/DrawOp.cs | 6 +- MCGalaxy/Drawing/DrawOps/DrawOpPerformer.cs | 6 -- MCGalaxy/Drawing/DrawOps/FillDrawOp.cs | 8 +- MCGalaxy/Drawing/DrawOps/HighlightDrawOp.cs | 2 +- MCGalaxy/Drawing/DrawOps/RedoDrawOp.cs | 2 +- MCGalaxy/Drawing/DrawOps/ReplaceDrawOp.cs | 4 +- .../Drawing/DrawOps/RestoreSelectionDrawOp.cs | 2 +- MCGalaxy/Drawing/DrawOps/UndoDrawOp.cs | 2 +- MCGalaxy/Drawing/DrawOps/UndoPhysicsDrawOp.cs | 8 +- MCGalaxy/MCGalaxy_.csproj | 1 + MCGalaxy/Player/Group/Group.cs | 6 +- MCGalaxy/Player/Group/GroupProperties.cs | 4 +- MCGalaxy/Player/Player.Handlers.cs | 3 +- MCGalaxy/util/Math/Vectors.cs | 1 + 23 files changed, 117 insertions(+), 69 deletions(-) create mode 100644 MCGalaxy/Commands/building/CmdReplaceAll.cs diff --git a/GUI/PropertyWindow/PropertyWindow.Ranks.cs b/GUI/PropertyWindow/PropertyWindow.Ranks.cs index d79689237..b84a5c3ec 100644 --- a/GUI/PropertyWindow/PropertyWindow.Ranks.cs +++ b/GUI/PropertyWindow/PropertyWindow.Ranks.cs @@ -76,7 +76,7 @@ namespace MCGalaxy.Gui { rank_cbAfk.Checked = grp.AfkKicked; rank_numAfk.Value = grp.AfkKickMinutes; - rank_numDraw.Value = grp.MaxBlocks; + rank_numDraw.Value = grp.DrawLimit; rank_numUndo.Value = grp.MaxUndo; rank_numMaps.Value = grp.OverseerMaps; rank_numGen.Value = grp.GenVolume; @@ -124,7 +124,7 @@ namespace MCGalaxy.Gui { void rank_numDraw_ValueChanged(object sender, EventArgs e) { - copiedGroups[rank_list.SelectedIndex].MaxBlocks = (int)rank_numDraw.Value; + copiedGroups[rank_list.SelectedIndex].DrawLimit = (int)rank_numDraw.Value; } void rank_numUndo_ValueChanged(object sender, EventArgs e) { diff --git a/MCGalaxy/Commands/Information/CmdHelp.cs b/MCGalaxy/Commands/Information/CmdHelp.cs index 3264e8f86..ad5e223d2 100644 --- a/MCGalaxy/Commands/Information/CmdHelp.cs +++ b/MCGalaxy/Commands/Information/CmdHelp.cs @@ -69,7 +69,7 @@ namespace MCGalaxy.Commands.Info { if (grp.Permission >= LevelPermission.Nobody) continue; // Note that -1 means max undo. Undo anything and everything. int count = grp.Players.Count; Player.Message(p, "{0} %S- Cmd: {2}, Undo: {3}, Perm: {4}", - grp.ColoredName, count, grp.MaxBlocks, + grp.ColoredName, count, grp.DrawLimit, grp.MaxUndo == -1 ? "max" : grp.MaxUndo.ToString(), (int)grp.Permission); } } diff --git a/MCGalaxy/Commands/Maintenance/CmdLimit.cs b/MCGalaxy/Commands/Maintenance/CmdLimit.cs index 66650e04f..ba2f32721 100644 --- a/MCGalaxy/Commands/Maintenance/CmdLimit.cs +++ b/MCGalaxy/Commands/Maintenance/CmdLimit.cs @@ -61,7 +61,7 @@ namespace MCGalaxy.Commands.Maintenance { case "dl": case "drawlimit": Chat.MessageGlobal("{0}%S's draw limit set to &b{1}", grp.ColoredName, limit); - grp.MaxBlocks = limit; break; + grp.DrawLimit = limit; break; case "mu": case "maxundo": Chat.MessageGlobal("{0}%S's undo limit set to &b{1}", grp.ColoredName, limit); diff --git a/MCGalaxy/Commands/building/CmdCopy.cs b/MCGalaxy/Commands/building/CmdCopy.cs index fb0dc10bd..1e56d2a76 100644 --- a/MCGalaxy/Commands/building/CmdCopy.cs +++ b/MCGalaxy/Commands/building/CmdCopy.cs @@ -119,9 +119,9 @@ namespace MCGalaxy.Commands.Building { index++; } - if (cState.UsedBlocks > p.group.MaxBlocks) { + if (cState.UsedBlocks > p.group.DrawLimit) { Player.Message(p, "You tried to copy {0} blocks. You cannot copy more than {1} blocks.", - cState.UsedBlocks, p.group.MaxBlocks); + cState.UsedBlocks, p.group.DrawLimit); cState.Clear(); cState = null; return false; } diff --git a/MCGalaxy/Commands/building/CmdDrill.cs b/MCGalaxy/Commands/building/CmdDrill.cs index b347775fa..5349c81bb 100644 --- a/MCGalaxy/Commands/building/CmdDrill.cs +++ b/MCGalaxy/Commands/building/CmdDrill.cs @@ -39,9 +39,9 @@ namespace MCGalaxy.Commands.Building { block = p.level.GetBlock(x, y, z); int dist = (ushort)state, numBlocks = (3 * 3) * dist; - if (numBlocks > p.group.MaxBlocks) { + if (numBlocks > p.group.DrawLimit) { Player.Message(p, "You tried to drill " + numBlocks + " blocks."); - Player.Message(p, "You cannot drill more than " + p.group.MaxBlocks + "."); + Player.Message(p, "You cannot drill more than " + p.group.DrawLimit + "."); return false; } diff --git a/MCGalaxy/Commands/building/CmdFill.cs b/MCGalaxy/Commands/building/CmdFill.cs index 82a8aaa99..cda90034a 100644 --- a/MCGalaxy/Commands/building/CmdFill.cs +++ b/MCGalaxy/Commands/building/CmdFill.cs @@ -65,7 +65,7 @@ namespace MCGalaxy.Commands.Building { int count = op.Positions.Count; bool confirmed = IsConfirmed(dArgs.Message), success = true; - if (count < p.group.MaxBlocks && count > p.level.ReloadThreshold && !confirmed) { + if (count < p.group.DrawLimit && count > p.level.ReloadThreshold && !confirmed) { Player.Message(p, "This fill would affect {0} blocks.", count); Player.Message(p, "If you still want to fill, type %T/fill {0} confirm", dArgs.Message); } else { diff --git a/MCGalaxy/Commands/building/CmdReplaceAll.cs b/MCGalaxy/Commands/building/CmdReplaceAll.cs new file mode 100644 index 000000000..5d0092f8b --- /dev/null +++ b/MCGalaxy/Commands/building/CmdReplaceAll.cs @@ -0,0 +1,81 @@ +/* + Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy) + + Dual-licensed under the Educational Community License, Version 2.0 and + the GNU General Public License, Version 3 (the "Licenses"); you may + not use this file except in compliance with the Licenses. You may + obtain a copy of the Licenses at + + http://www.opensource.org/licenses/ecl2.php + http://www.gnu.org/licenses/gpl-3.0.html + + Unless required by applicable law or agreed to in writing, + software distributed under the Licenses are distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + or implied. See the Licenses for the specific language governing + permissions and limitations under the Licenses. + */ +using System; +using MCGalaxy.Drawing.Brushes; +using MCGalaxy.Drawing.Ops; +using MCGalaxy.Maths; + +namespace MCGalaxy.Commands.Building { + + public sealed class CmdReplaceAll : Command { + public override string name { get { return "replaceall"; } } + public override string shortcut { get { return "ra"; } } + public override string type { get { return CommandTypes.Building; } } + public override bool museumUsable { get { return false; } } + public override LevelPermission defaultRank { get { return LevelPermission.Admin; } } + + public override void Use(Player p, string message) { + BrushArgs args = new BrushArgs(p, message.ToLower(), ExtBlock.Air); + Brush brush = BrushFactory.Find("replace").Construct(args); + if (brush == null) return; + + Vec3S32 max = new Vec3S32(p.level.Width - 1, p.level.Height - 1, p.level.Length - 1); + Vec3S32[] marks = new Vec3S32[] { Vec3S32.Zero, max }; + + MeasureDrawOp measure = new MeasureDrawOp(); + DrawOpPerformer.Setup(measure, p, marks); + measure.Perform(marks, brush, null); + + if (measure.Total > p.group.DrawLimit) { + Player.Message(p, "You tried to replace " + measure.Total + " blocks."); + Player.Message(p, "You cannot draw more than " + p.group.DrawLimit + "."); + return; + } + + DrawOp op = new CuboidDrawOp(); + op.AffectedByTransform = false; + if (!DrawOpPerformer.Do(op, brush, p, marks, false)) return; + Player.Message(p, "&4/replaceall finished!"); + } + + + class MeasureDrawOp : DrawOp { + public override string Name { get { return null; } } + public override long BlocksAffected(Level lvl, Vec3S32[] marks) { return 0; } + public int Total = 0; + + public override void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output) { + Vec3U16 p1 = Clamp(Min), p2 = Clamp(Max); + for (ushort y = p1.Y; y <= p2.Y; y++) + for (ushort z = p1.Z; z <= p2.Z; z++) + for (ushort x = p1.X; x <= p2.X; x++) + { + Coords.X = x; Coords.Y = y; Coords.Z = z; + if (!brush.NextBlock(this).IsInvalid) Total++; + } + } + } + + public override void Help(Player p) { + Player.Message(p, "%T/replaceall [block] [block2].. [new]"); + Player.Message(p, "%HReplaces [block] with [new] for the entire map."); + Player.Message(p, "%H If more than one [block] is given, they are all replaced."); + Player.Message(p, "%H If only [block] is given, replaces with your held block."); + } + } +} diff --git a/MCGalaxy/Commands/building/ReplaceCmd.cs b/MCGalaxy/Commands/building/ReplaceCmd.cs index 97c36a393..5d446e83a 100644 --- a/MCGalaxy/Commands/building/ReplaceCmd.cs +++ b/MCGalaxy/Commands/building/ReplaceCmd.cs @@ -55,34 +55,4 @@ namespace MCGalaxy.Commands.Building { Player.Message(p, "%H If only [block] is given, replaces with your held block."); } } - - public sealed class CmdReplaceAll : Command { - public override string name { get { return "replaceall"; } } - public override string shortcut { get { return "ra"; } } - public override string type { get { return CommandTypes.Building; } } - public override bool museumUsable { get { return false; } } - public override LevelPermission defaultRank { get { return LevelPermission.Admin; } } - - public override void Use(Player p, string message) { - ushort x2 = (ushort)(p.level.Width - 1); - ushort y2 = (ushort)(p.level.Height - 1); - ushort z2 = (ushort)(p.level.Length - 1); - - BrushArgs args = new BrushArgs(p, message.ToLower(), ExtBlock.Air); - Brush brush = BrushFactory.Find("replace").Construct(args); - if (brush == null) return; - - DrawOp op = new CuboidDrawOp(); - if (!DrawOpPerformer.Do(op, brush, p, 0, 0, 0, x2, y2, z2)) - return; - Player.Message(p, "&4/replaceall finished!"); - } - - public override void Help(Player p) { - Player.Message(p, "%T/replaceall [block] [block2].. [new]"); - Player.Message(p, "%HReplaces [block] with [new] for the entire map."); - Player.Message(p, "%H If more than one [block] is given, they are all replaced."); - Player.Message(p, "%H If only [block] is given, replaces with your held block."); - } - } } diff --git a/MCGalaxy/Drawing/DrawOps/CuboidDrawOp.cs b/MCGalaxy/Drawing/DrawOps/CuboidDrawOp.cs index 63ae2fa08..6b4c30a9a 100644 --- a/MCGalaxy/Drawing/DrawOps/CuboidDrawOp.cs +++ b/MCGalaxy/Drawing/DrawOps/CuboidDrawOp.cs @@ -22,7 +22,7 @@ using MCGalaxy.Maths; namespace MCGalaxy.Drawing.Ops { - public class CuboidDrawOp : DrawOp { + public class CuboidDrawOp : DrawOp { public override string Name { get { return "Cuboid"; } } public override long BlocksAffected(Level lvl, Vec3S32[] marks) { diff --git a/MCGalaxy/Drawing/DrawOps/DrawOp.cs b/MCGalaxy/Drawing/DrawOps/DrawOp.cs index 875b0bc17..b97007b88 100644 --- a/MCGalaxy/Drawing/DrawOps/DrawOp.cs +++ b/MCGalaxy/Drawing/DrawOps/DrawOp.cs @@ -74,7 +74,7 @@ namespace MCGalaxy.Drawing.Ops { public abstract string Name { get; } /// Whether the output blocks this draw operation are affected by the player's current Transform. - public virtual bool AffectedByTransform { get { return true; } } + 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.
@@ -83,9 +83,9 @@ namespace MCGalaxy.Drawing.Ops { public abstract void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output); public virtual bool CanDraw(Vec3S32[] marks, Player p, long affected) { - if (p != null && affected > p.group.MaxBlocks) { + if (p != null && affected > p.group.DrawLimit) { Player.Message(p, "You tried to draw " + affected + " blocks."); - Player.Message(p, "You cannot draw more than " + p.group.MaxBlocks + "."); + Player.Message(p, "You cannot draw more than " + p.group.DrawLimit + "."); return false; } return true; diff --git a/MCGalaxy/Drawing/DrawOps/DrawOpPerformer.cs b/MCGalaxy/Drawing/DrawOps/DrawOpPerformer.cs index facb67bbd..07e0f9a31 100644 --- a/MCGalaxy/Drawing/DrawOps/DrawOpPerformer.cs +++ b/MCGalaxy/Drawing/DrawOps/DrawOpPerformer.cs @@ -37,12 +37,6 @@ namespace MCGalaxy.Drawing.Ops { public static class DrawOpPerformer { - public static bool Do(DrawOp op, Brush brush, Player p, - ushort x1, ushort y1, ushort z1, ushort x2, ushort y2, ushort z2) { - Vec3S32[] marks = new Vec3S32[] { new Vec3S32(x1, y1, z1), new Vec3S32(x2, y2, z2) }; - return Do(op, brush, p, marks); - } - public static Level Setup(DrawOp op, Player p, Vec3S32[] marks) { op.SetMarks(marks); Level lvl = p == null ? null : p.level; diff --git a/MCGalaxy/Drawing/DrawOps/FillDrawOp.cs b/MCGalaxy/Drawing/DrawOps/FillDrawOp.cs index 984e2bf11..d40ccfa21 100644 --- a/MCGalaxy/Drawing/DrawOps/FillDrawOp.cs +++ b/MCGalaxy/Drawing/DrawOps/FillDrawOp.cs @@ -31,19 +31,19 @@ namespace MCGalaxy.Drawing.Ops { public FillDrawOp() { Flags = BlockDBFlags.Filled; + AffectedByTransform = false; } public override string Name { get { return "Fill"; } } - public override bool AffectedByTransform { get { return false; } } public override long BlocksAffected(Level lvl, Vec3S32[] marks) { return Positions.Count; } public override bool CanDraw(Vec3S32[] marks, Player p, long affected) { - if (affected > p.group.MaxBlocks) { + if (affected > p.group.DrawLimit) { Player.Message(p, "You rank can only fill up to {0} blocks. " + - "This fill would affect more than {0} blocks.", p.group.MaxBlocks); + "This fill would affect more than {0} blocks.", p.group.DrawLimit); return false; } return true; @@ -70,7 +70,7 @@ namespace MCGalaxy.Drawing.Ops { int* pos = stackalloc int[max]; pos[0] = index; count++; - while (count > 0 && buffer.Count <= p.group.MaxBlocks) { + while (count > 0 && buffer.Count <= p.group.DrawLimit) { index = pos[count - 1]; count--; ushort x = (ushort)(index % lvl.Width); ushort y = (ushort)((index / lvl.Width) / lvl.Length); diff --git a/MCGalaxy/Drawing/DrawOps/HighlightDrawOp.cs b/MCGalaxy/Drawing/DrawOps/HighlightDrawOp.cs index f8abcca71..52be298b3 100644 --- a/MCGalaxy/Drawing/DrawOps/HighlightDrawOp.cs +++ b/MCGalaxy/Drawing/DrawOps/HighlightDrawOp.cs @@ -27,7 +27,6 @@ namespace MCGalaxy.Drawing.Ops { public class HighlightDrawOp : DrawOp { public override string Name { get { return "Highlight"; } } - public override bool AffectedByTransform { get { return false; } } /// Point in time that the /highlight should go backwards up to. public DateTime Start = DateTime.MinValue; @@ -46,6 +45,7 @@ namespace MCGalaxy.Drawing.Ops { public HighlightDrawOp() { Flags = 0; Undoable = false; + AffectedByTransform = false; } public override long BlocksAffected(Level lvl, Vec3S32[] marks) { return -1; } diff --git a/MCGalaxy/Drawing/DrawOps/RedoDrawOp.cs b/MCGalaxy/Drawing/DrawOps/RedoDrawOp.cs index 28a9417c1..21741081f 100644 --- a/MCGalaxy/Drawing/DrawOps/RedoDrawOp.cs +++ b/MCGalaxy/Drawing/DrawOps/RedoDrawOp.cs @@ -25,7 +25,6 @@ namespace MCGalaxy.Drawing.Ops { public class RedoSelfDrawOp : DrawOp { public override string Name { get { return "RedoSelf"; } } - public override bool AffectedByTransform { get { return false; } } /// Point in time that the /undo should go backwards up to. public DateTime Start = DateTime.MinValue; @@ -35,6 +34,7 @@ namespace MCGalaxy.Drawing.Ops { public RedoSelfDrawOp() { Flags = BlockDBFlags.RedoSelf; + AffectedByTransform = false; } public override long BlocksAffected(Level lvl, Vec3S32[] marks) { return -1; } diff --git a/MCGalaxy/Drawing/DrawOps/ReplaceDrawOp.cs b/MCGalaxy/Drawing/DrawOps/ReplaceDrawOp.cs index ab82d7d24..4d998b527 100644 --- a/MCGalaxy/Drawing/DrawOps/ReplaceDrawOp.cs +++ b/MCGalaxy/Drawing/DrawOps/ReplaceDrawOp.cs @@ -30,10 +30,10 @@ namespace MCGalaxy.Drawing.Ops { public ReplaceDrawOp(ExtBlock include) { Include = include; Flags = BlockDBFlags.Replaced; + AffectedByTransform = false; } public override string Name { get { return "Replace"; } } - public override bool AffectedByTransform { get { return false; } } public override long BlocksAffected(Level lvl, Vec3S32[] marks) { return (Max.X - Min.X + 1) * (Max.Y - Min.Y + 1) * (Max.Z - Min.Z + 1); @@ -58,10 +58,10 @@ namespace MCGalaxy.Drawing.Ops { public ReplaceNotDrawOp(ExtBlock exclude) { Exclude = exclude; Flags = BlockDBFlags.Replaced; + AffectedByTransform = false; } public override string Name { get { return "ReplaceNot"; } } - public override bool AffectedByTransform { get { return false; } } public override long BlocksAffected(Level lvl, Vec3S32[] marks) { return (Max.X - Min.X + 1) * (Max.Y - Min.Y + 1) * (Max.Z - Min.Z + 1); diff --git a/MCGalaxy/Drawing/DrawOps/RestoreSelectionDrawOp.cs b/MCGalaxy/Drawing/DrawOps/RestoreSelectionDrawOp.cs index e93fb06b2..581e66fcf 100644 --- a/MCGalaxy/Drawing/DrawOps/RestoreSelectionDrawOp.cs +++ b/MCGalaxy/Drawing/DrawOps/RestoreSelectionDrawOp.cs @@ -24,7 +24,6 @@ namespace MCGalaxy.Drawing.Ops { public class RestoreSelectionDrawOp : DrawOp { public override string Name { get { return "RestoreSelection"; } } - public override bool AffectedByTransform { get { return false; } } public override long BlocksAffected(Level lvl, Vec3S32[] marks) { return (Max.X - Min.X + 1) * (Max.Y - Min.Y + 1) * (Max.Z - Min.Z + 1); @@ -32,6 +31,7 @@ namespace MCGalaxy.Drawing.Ops { public RestoreSelectionDrawOp() { Flags = BlockDBFlags.Restored; + AffectedByTransform = false; } public Level Source; diff --git a/MCGalaxy/Drawing/DrawOps/UndoDrawOp.cs b/MCGalaxy/Drawing/DrawOps/UndoDrawOp.cs index 3cf0229cf..ce5eee7ea 100644 --- a/MCGalaxy/Drawing/DrawOps/UndoDrawOp.cs +++ b/MCGalaxy/Drawing/DrawOps/UndoDrawOp.cs @@ -36,7 +36,6 @@ namespace MCGalaxy.Drawing.Ops { public class UndoDrawOp : DrawOp { public override string Name { get { return "Undo"; } } - public override bool AffectedByTransform { get { return false; } } /// Point in time that the /undo should go backwards up to. public DateTime Start = DateTime.MinValue; @@ -50,6 +49,7 @@ namespace MCGalaxy.Drawing.Ops { public UndoDrawOp() { Flags = BlockDBFlags.UndoOther; + AffectedByTransform = false; } public override long BlocksAffected(Level lvl, Vec3S32[] marks) { return -1; } diff --git a/MCGalaxy/Drawing/DrawOps/UndoPhysicsDrawOp.cs b/MCGalaxy/Drawing/DrawOps/UndoPhysicsDrawOp.cs index 3138168d7..e67839a70 100644 --- a/MCGalaxy/Drawing/DrawOps/UndoPhysicsDrawOp.cs +++ b/MCGalaxy/Drawing/DrawOps/UndoPhysicsDrawOp.cs @@ -23,10 +23,12 @@ using MCGalaxy.Maths; namespace MCGalaxy.Drawing.Ops { public class UndoPhysicsDrawOp : DrawOp { - public override string Name { get { return "UndoPhysics"; } } - public override bool AffectedByTransform { get { return false; } } - + public override string Name { get { return "UndoPhysics"; } } internal DateTime Start; + + public UndoPhysicsDrawOp() { + AffectedByTransform = false; + } public override long BlocksAffected(Level lvl, Vec3S32[] marks) { return -1; } diff --git a/MCGalaxy/MCGalaxy_.csproj b/MCGalaxy/MCGalaxy_.csproj index c932efddc..eead6c359 100644 --- a/MCGalaxy/MCGalaxy_.csproj +++ b/MCGalaxy/MCGalaxy_.csproj @@ -153,6 +153,7 @@ + diff --git a/MCGalaxy/Player/Group/Group.cs b/MCGalaxy/Player/Group/Group.cs index 2a03a7188..6fbe26226 100644 --- a/MCGalaxy/Player/Group/Group.cs +++ b/MCGalaxy/Player/Group/Group.cs @@ -43,7 +43,7 @@ namespace MCGalaxy { public LevelPermission Permission = LevelPermission.Null; /// Maximum number of blocks members of this group can use in draw commands. - public int MaxBlocks; + public int DrawLimit; /// Maximum number of seconds members of this group can /undo up to. public int MaxUndo; @@ -81,7 +81,7 @@ namespace MCGalaxy { private Group(LevelPermission perm, int maxB, int maxUn, string name, char colCode) { Permission = perm; - MaxBlocks = maxB; + DrawLimit = maxB; MaxUndo = maxUn; Name = name; Color = "&" + colCode; @@ -115,7 +115,7 @@ namespace MCGalaxy { public Group CopyConfig() { Group copy = new Group(); copy.Name = Name; copy.Color = Color; copy.Permission = Permission; - copy.MaxBlocks = MaxBlocks; copy.MaxUndo = MaxUndo; copy.MOTD = MOTD; + copy.DrawLimit = DrawLimit; copy.MaxUndo = MaxUndo; copy.MOTD = MOTD; copy.GenVolume = GenVolume; copy.OverseerMaps = OverseerMaps; copy.AfkKicked = AfkKicked; copy.AfkKickMinutes = AfkKickMinutes; copy.Prefix = Prefix; copy.filename = filename; diff --git a/MCGalaxy/Player/Group/GroupProperties.cs b/MCGalaxy/Player/Group/GroupProperties.cs index df5f875ee..25d1a8d28 100644 --- a/MCGalaxy/Player/Group/GroupProperties.cs +++ b/MCGalaxy/Player/Group/GroupProperties.cs @@ -68,7 +68,7 @@ namespace MCGalaxy { } break; case "limit": - temp.MaxBlocks = int.Parse(value); + temp.DrawLimit = int.Parse(value); break; case "maxundo": temp.MaxUndo = int.Parse(value); @@ -173,7 +173,7 @@ namespace MCGalaxy { foreach (Group grp in givenList) { w.WriteLine("RankName = " + grp.Name); w.WriteLine("Permission = " + (int)grp.Permission); - w.WriteLine("Limit = " + grp.MaxBlocks); + w.WriteLine("Limit = " + grp.DrawLimit); w.WriteLine("MaxUndo = " + grp.MaxUndo); w.WriteLine("Color = " + grp.Color[1]); w.WriteLine("MOTD = " + grp.MOTD); diff --git a/MCGalaxy/Player/Player.Handlers.cs b/MCGalaxy/Player/Player.Handlers.cs index ac7433925..8b5dafaa2 100644 --- a/MCGalaxy/Player/Player.Handlers.cs +++ b/MCGalaxy/Player/Player.Handlers.cs @@ -598,7 +598,6 @@ namespace MCGalaxy { public void HandleCommand(string cmd, string message) { cmd = cmd.ToLower(); try { - if (!CheckCommand(cmd)) return; Command command = GetCommand(ref cmd, ref message); if (command == null) return; @@ -620,7 +619,6 @@ namespace MCGalaxy { string cmd = parts[0].ToLower(); string message = parts.Length > 1 ? parts[1] : ""; - if (!CheckCommand(cmd)) return; Command command = GetCommand(ref cmd, ref message); if (command == null) return; @@ -658,6 +656,7 @@ namespace MCGalaxy { } Command GetCommand(ref string cmd, ref string cmdArgs) { + if (!CheckCommand(cmd)) return null; Command.Search(ref cmd, ref cmdArgs); byte bindIndex; diff --git a/MCGalaxy/util/Math/Vectors.cs b/MCGalaxy/util/Math/Vectors.cs index d7cce796b..7245ff6b5 100644 --- a/MCGalaxy/util/Math/Vectors.cs +++ b/MCGalaxy/util/Math/Vectors.cs @@ -92,6 +92,7 @@ namespace MCGalaxy.Maths { public struct Vec3S32 : IEquatable { public int X, Y, Z; + public static Vec3S32 Zero = new Vec3S32(0); public Vec3S32(int x, int y, int z) { X = x; Y = y; Z = z;