internal static void RegisterCommand(ISynapseCommand iSynapseCommand, bool awaitPluginInitialisation) { if (awaitPluginInitialisation) { AwaitingFinalization.Add(iSynapseCommand); return; } var command = GeneratedCommand.FromSynapseCommand(iSynapseCommand); foreach (var platform in command.Platforms) { switch (platform) { case Platform.ClientConsole: SynapseController.CommandHandlers.ClientCommandHandler.RegisterCommand(command); break; case Platform.RemoteAdmin: SynapseController.CommandHandlers.RemoteAdminHandler.RegisterCommand(command); break; case Platform.ServerConsole: SynapseController.CommandHandlers.ServerConsoleHandler.RegisterCommand(command); break; } } }
internal static void RegisterCommand(ISynapseCommand iSynapseCommand, bool awaitPluginInitialisation) { if (awaitPluginInitialisation) { AwaitingFinalization.Add(iSynapseCommand); return; } RegisterGeneratedCommand(GeneratedCommand.FromSynapseCommand(iSynapseCommand)); }
public static GeneratedCommand FromSynapseCommand(ISynapseCommand command) { var type = command.GetType(); var cmdInf = type.GetCustomAttribute <CommandInformation>(); return(new GeneratedCommand { OnCommand = command.Execute, Name = cmdInf.Name, Aliases = cmdInf.Aliases, Permission = cmdInf.Permission ?? "", Usage = cmdInf.Usage, Description = cmdInf.Description ?? "", Platforms = cmdInf.Platforms ?? new [] { Platform.RemoteAdmin, Platform.ServerConsole } }); }