public void CatchBlock(PlayerEvent e) { OnPlayerBlockChange args = (OnPlayerBlockChange)e; CatchPos cpos = (CatchPos)args.datapass; cpos.pos = new Vector3(args.x, args.y, args.z); args.Unregister(); args.Cancel(); OnPlayerBlockChange.Register(CatchBlock2, args.Player, cpos); }
public void CatchBlock2(PlayerEvent e) { OnPlayerBlockChange bc = (OnPlayerBlockChange)e; Player p = bc.Player; ushort x = bc.x; ushort y = bc.y; ushort z = bc.z; byte NewType = bc.holding; bool placed = (bc.action == ActionType.Place); CatchPos FirstBlock = (CatchPos)bc.datapass; unchecked { if (FirstBlock.type != (byte)-1) { NewType = FirstBlock.type; } } List<Pos> buffer = new List<Pos>(); for (ushort xx = Math.Min((ushort)(FirstBlock.pos.x), x); xx <= Math.Max((ushort)(FirstBlock.pos.x), x); ++xx) { for (ushort zz = Math.Min((ushort)(FirstBlock.pos.z), z); zz <= Math.Max((ushort)(FirstBlock.pos.z), z); ++zz) { for (ushort yy = Math.Min((ushort)(FirstBlock.pos.y), y); yy <= Math.Max((ushort)(FirstBlock.pos.y), y); ++yy) { Vector3 loop = new Vector3(xx, zz, yy); if (p.Level.GetBlock(loop) == NewType) { BufferAdd(buffer, loop); } } } } //Group Max Blocks permissions here p.SendMessage(buffer.Count.ToString() + " blocks."); //Level Blockqueue .-. buffer.ForEach(delegate(Pos pos) { p.Level.BlockChange((ushort)(pos.pos.x), (ushort)(pos.pos.z), (ushort)(pos.pos.y), FirstBlock.type2); }); }