View difference between Paste ID: pXpcEuwg and AwzsjCps
SHOW: | | - or go back to the newest paste.
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using fCraft;
6
7
8
namespace Hello
9
{
10
    public class Init : Plugin
11
    {
12
        //everything that will happen upon startup
13
        public void Initialize()
14
        {
15
            Logger.Log(
16
                LogType.ConsoleOutput,
17
                Name + "(v " + Version + "): Registering Hello");
18
19
            //In this plugin, i am making a simple command
20
            //This code block right here "describes" the command
21
            CommandManager.RegisterCustomCommand(new CommandDescriptor
22
            {
23
                Name = "Hello",
24
                Aliases = new string[] { "Hi" },
25
                Category = CommandCategory.Chat | CommandCategory.Fun,
26
                Permissions = new Permission[] { Permission.Chat },
27
                IsConsoleSafe = true,
28
                Usage = "/Hello",
29
                Help = "Shouts out 'Hello' to the server!",
30
                Handler = HelloHandler,
31
            });
32
        }
33
34
        //plugin name
35
        public string Name
36
        {
37
            get
38
            {
39
                return "HelloPlugin";
40
            }
41
            set
42
            {
43
                Name = value;
44
            }
45
        }
46
47
        //plugin version
48
        public string Version
49
        {
50
            get
51
            {
52
                return "1.0";
53
            }
54
            set
55
            {
56
                Version = value;
57
            }
58
        }
59
60-
        private static void HelloHandler(Player player, Command cmd)//handler name must be the same as in descriptor
60+
        //handler name must be the same as in descriptor
61
        private static void HelloHandler(Player player, Command cmd)
62
        {
63
64
           //all the main code for your plugin will go here!
65
66
           Server.Message("Hello!");//will send a message to everyone on the server          
67
        }
68
69
        //the end
70
    }
71
}