Esempio n. 1
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                Help(p);
                return;
            }
            if (!p.Supports(CpeExt.HeldBlock))
            {
                p.Message("Your client doesn't support changing your held block.");
                return;
            }
            string[] args = message.SplitSpaces(2);

            BlockID block;

            if (!CommandParser.GetBlock(p, args[0], out block))
            {
                return;
            }
            bool locked = false;

            if (args.Length > 1 && !CommandParser.GetBool(p, args[1], ref locked))
            {
                return;
            }

            if (Block.IsPhysicsType(block))
            {
                p.Message("Cannot hold physics blocks");
                return;
            }

            BlockID raw = p.ConvertBlock(block);

            p.Send(Packet.HoldThis(raw, locked, p.hasExtBlocks));
        }