Beispiel #1
0
        internal void Run(ISender sender, ArgumentList args)
        {
            if (BeforeEvent != null)
            {
                BeforeEvent(this);
            }

            try
            {
                if (!CommandParser.CheckAccessLevel(this, sender))
                {
                    sender.SendMessage("You cannot perform that action.", 255, 238, 130, 238);
                    return;
                }

                if (tokenCallback != null)
                {
                    tokenCallback(sender, args);
                }
                else if (LuaCallback != null)
                {
                    LuaCallback.Call(this, sender, args);
                }
                else
                {
                    sender.SendMessage("This command is no longer available", 255, 238, 130, 238);
                }
            }
            finally
            {
                if (AfterEvent != null)
                {
                    AfterEvent(this);
                }
            }
        }
Beispiel #2
0
 public static Dictionary <string, CommandInfo> GetAvailableCommands(this Dictionary <string, CommandInfo> map, ISender sender)
 {
     return(map
            .Where(x => CommandParser.CheckAccessLevel(x.Value, sender) && !x.Key.StartsWith("."))
            .ToDictionary(x => x.Key, y => y.Value));
 }