コード例 #1
0
        public override void Use(Player p, string message, CommandData data)
        {
            bool area = message.CaselessStarts("-area");

            if (area)
            {
                message = message.Substring("-area".Length).TrimStart();
            }

            if (CheckSuper(p, message, "player name"))
            {
                return;
            }
            if (message.Length == 0)
            {
                p.Message("You need to provide a player name."); return;
            }

            string[] parts = message.SplitSpaces(), names = null;
            int[]    ids   = GetIds(p, parts, data, out names);
            if (ids == null)
            {
                return;
            }

            TimeSpan delta = CmdUndo.GetDelta(p, parts[0], parts, 1);

            if (delta == TimeSpan.MinValue)
            {
                return;
            }

            if (!area)
            {
                Vec3S32[] marks = new Vec3S32[] { Vec3U16.MinVal, Vec3U16.MaxVal };
                UndoPlayer(p, delta, names, ids, marks);
            }
            else
            {
                p.Message("Place or break two blocks to determine the edges.");
                UndoAreaArgs args = new UndoAreaArgs();
                args.ids = ids; args.names = names; args.delta = delta;
                p.MakeSelection(2, "Selecting region for %SUndo player", args, DoUndoArea);
            }
        }
コード例 #2
0
        public override void Use(Player p, string message)
        {
            UndoAreaArgs args = default(UndoAreaArgs);

            if (Player.IsSuper(p))
            {
                MessageInGameOnly(p); return;
            }
            if (message == "")
            {
                Player.Message(p, "You need to provide a player name."); return;
            }

            string[] parts = message.Split(' ');
            args.message = parts[0];
            args.delta   = GetDelta(p, null, parts.Length > 1 ? parts[1] : "30m");
            if (args.delta == TimeSpan.MinValue)
            {
                return;
            }

            Player.Message(p, "Place two blocks to determine the edges.");
            p.MakeSelection(2, args, DoUndo);
        }