예제 #1
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0 || message.IndexOf(' ') == -1)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(2);

            if (IsCreateCommand(args[0]))
            {
                args = args[1].Split(awardArgs, 2);
                if (args.Length == 1)
                {
                    p.Message("%WUse a : to separate the award name from its description.");
                    Help(p); return;
                }

                if (!Awards.Add(args[0], args[1]))
                {
                    p.Message("This award already exists."); return;
                }
                else
                {
                    Chat.MessageGlobal("Award added: &6{0} : {1}", args[0], args[1]);
                    Awards.SaveAwards();
                }
            }
            else if (IsDeleteCommand(args[0]))
            {
                if (!Awards.Remove(args[1]))
                {
                    p.Message("This award does not exist."); return;
                }
                else
                {
                    Chat.MessageGlobal("Award removed: &6{0}", args[1]);
                    Awards.SaveAwards();
                }
            }
            else
            {
                Help(p);
            }
        }
예제 #2
0
        public override void Use(Player p, string message)
        {
            if (message == "" || message.IndexOf(' ') == -1)
            {
                Help(p); return;
            }
            string[] args = message.SplitSpaces(2);
            if (!(args[0].CaselessEq("add") || args[0].CaselessEq("del")))
            {
                Help(p); return;
            }

            if (args[0].CaselessEq("add"))
            {
                args = args[1].Split(awardArgs, 2);
                if (args.Length == 1)
                {
                    Player.Message(p, "&cUse a : to separate the award name from its description.");
                    Help(p); return;
                }

                if (!Awards.Add(args[0], args[1]))
                {
                    Player.Message(p, "This award already exists."); return;
                }
                else
                {
                    Chat.MessageAll("Award added: &6{0} : {1}", args[0], args[1]);
                    Awards.SaveAwards();
                }
            }
            else
            {
                if (!Awards.Remove(args[1]))
                {
                    Player.Message(p, "This award does not exist."); return;
                }
                else
                {
                    Chat.MessageAll("Award removed: &6{0}", args[1]);
                    Awards.SaveAwards();
                }
            }
        }