示例#1
0
        public bool CanCallCommand(string command)
        {
            if (GameServer.Instance.CommandExec.CommandExists(command))
            {
                CommandDescription desc = GameServer.Instance.CommandExec.GetCommandDescription(command);
                switch (Permission)
                {
                case PermissionLevel.Server:
                    return(true);

                case PermissionLevel.Admin:
                    return(desc.permission == PermissionLevel.Admin ||
                           desc.permission == PermissionLevel.Moderator ||
                           desc.permission == PermissionLevel.User);

                case PermissionLevel.Moderator:
                    return(desc.permission == PermissionLevel.Moderator ||
                           desc.permission == PermissionLevel.User);

                case PermissionLevel.User:
                    return(desc.permission == PermissionLevel.User);

                default:
                    return(false);
                }
            }
            return(false);
        }
示例#2
0
 public void RegisterCommand(CommandDescription command)
 {
     _cmdTable [command.command.ToLower()]       = command.callback;
     _cmdDescription [command.command.ToLower()] = command;
 }
 public void RegisterCommand(CommandDescription command)
 {
     _cmdTable [command.command.ToLower ()] = command.callback;
     _cmdDescription [command.command.ToLower ()] = command;
 }