public void RegisterFromAssembly(Assembly assembly) { foreach (Type commandType in RocketHelper.NewGetTypesFromInterface(assembly, typeof(IRocketCommand))) { if (commandType.GetConstructor(Type.EmptyTypes) != null) { IRocketCommand command = (IRocketCommand)Activator.CreateInstance(commandType); Register(command); foreach (string alias in command.Aliases) { Register(command, alias); } } } Type plugin = RocketHelper.NewGetTypeFromInterface(assembly, typeof(IRocketPlugin)); if (plugin != null) { MethodInfo[] methodInfos = plugin.GetMethods(BindingFlags.Public | BindingFlags.Instance); foreach (MethodInfo method in methodInfos) { RocketCommandAttribute commandAttribute = (RocketCommandAttribute)Attribute.GetCustomAttribute(method, typeof(RocketCommandAttribute)); RocketCommandAliasAttribute[] commandAliasAttributes = (RocketCommandAliasAttribute[])Attribute.GetCustomAttributes(method, typeof(RocketCommandAliasAttribute)); RocketCommandPermissionAttribute[] commandPermissionAttributes = (RocketCommandPermissionAttribute[])Attribute.GetCustomAttributes(method, typeof(RocketCommandPermissionAttribute)); if (commandAttribute != null) { List <string> Permissions = new List <string>(); List <string> Aliases = new List <string>(); if (commandAliasAttributes != null) { foreach (RocketCommandAliasAttribute commandAliasAttribute in commandAliasAttributes) { Aliases.Add(commandAliasAttribute.Name); } } if (commandPermissionAttributes != null) { foreach (RocketCommandPermissionAttribute commandPermissionAttribute in commandPermissionAttributes) { Aliases.Add(commandPermissionAttribute.Name); } } IRocketCommand command = new RocketAttributeCommand(commandAttribute.Name, commandAttribute.Help, commandAttribute.Syntax, commandAttribute.AllowedCaller, Permissions, Aliases, method); Register(command); foreach (string alias in command.Aliases) { Register(command, alias); } } } } }