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!"); }
static void HighlightPlayer(Player p, TimeSpan delta, string who, int[] ids, Vec3S32[] marks) { HighlightDrawOp op = new HighlightDrawOp(); op.Start = DateTime.UtcNow.Subtract(delta); op.who = who; op.ids = ids; DrawOpPerformer.Setup(op, p, marks); BufferedBlockSender buffer = new BufferedBlockSender(p); op.Perform(marks, null, P => { int index = p.level.PosToInt(P.X, P.Y, P.Z); buffer.Add(index, P.Block); }); buffer.Send(true); if (op.found) { p.Message("Now highlighting past &b{0} %Sfor {1}", delta.Shorten(true), PlayerInfo.GetColoredName(p, who)); p.Message("%WUse /reload to un-highlight"); } else { p.Message("No changes found by {1} %Sin the past &b{0}", delta.Shorten(true), PlayerInfo.GetColoredName(p, who)); } }