Adding a command

This example shows a class that will add a command to PartyCraft. This class can be anywhere in your project, and must inherit from PartyCraft.Commands.Command.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LibMinecraft.Server;
using PartyCraft;
using PartyCraftServer.Commands;

namespace HelloCommand
{
    public class ListCommand : Command
    {
        public override bool RequiresOp
        {
            get { return false; } // If true, thecommand will only run if an OP uses it
        }

        public override string DefaultCommand
        {
            get { return "hello"; } // In this case, our command is /hello
        }

        public override string Documentation
        {
            get { return "Says hello!"; } // Used by /help
        }

        public override void ExecuteCommand(RemoteClient client,
                params string[] parameters)
        {
            PartyCraft.Server.SendChat("Hello, world!");
        }
    }
}

Last edited Jan 25, 2012 at 6:54 AM by sircmpwn, version 1

Comments

No comments yet.