private static Type getCommandType(IRocketCommand command) { if (command is RocketAttributeCommand) { return(((RocketAttributeCommand)command).Method.ReflectedType); } else if (command.GetType().ReflectedType != null) { return(command.GetType().ReflectedType); } else { return(command.GetType()); } }
private static string getCommandIdentity(IRocketCommand command, string name) { if (command is RocketAttributeCommand) { return(((RocketAttributeCommand)command).Method.ReflectedType.FullName + "/" + name); } else if (command.GetType().ReflectedType != null) { return(command.GetType().ReflectedType.FullName + "/" + name); } else { return(command.GetType().FullName + "/" + name); } }
public void Execute(IRocketPlayer caller, string[] command) { if (command.Length == 0) { UnturnedChat.Say(caller, "[Vanilla]"); Commander.commands.OrderBy(c => c.command).All(c => { UnturnedChat.Say(caller, c.command.ToLower().PadRight(20, ' ') + " " + c.info.Replace(c.command, "").TrimStart().ToLower()); return(true); }); UnturnedChat.Say(caller, "---"); UnturnedChat.Say(caller, "[Rocket]"); R.Commands.Commands.Where(c => c.GetType().Assembly == Assembly.GetExecutingAssembly()).OrderBy(c => c.Name).All(c => { UnturnedChat.Say(caller, c.Name.ToLower().PadRight(20, ' ') + " " + c.Syntax.ToLower()); return(true); }); UnturnedChat.Say(caller, "---"); foreach (IRocketPlugin plugin in R.Plugins.GetPlugins()) { UnturnedChat.Say(caller, "[" + plugin.GetType().Assembly.GetName().Name + "]"); R.Commands.Commands.Where(c => c.GetType().Assembly == plugin.GetType().Assembly).OrderBy(c => c.Name).All(c => { UnturnedChat.Say(caller, c.Name.ToLower().PadRight(20, ' ') + " " + c.Syntax.ToLower()); return(true); }); UnturnedChat.Say(caller, "---"); } } else { IRocketCommand cmd = R.Commands.Commands.Where(c => (String.Compare(c.Name, command[0], true) == 0)).FirstOrDefault(); if (cmd != null) { string commandName = cmd.GetType().Assembly.GetName().Name + " / " + cmd.Name; UnturnedChat.Say(caller, "[" + commandName + "]"); UnturnedChat.Say(caller, cmd.Name + "\t\t" + cmd.Syntax); UnturnedChat.Say(caller, cmd.Help); } } }
private string getCommandClass(IRocketCommand command) { if (command is RocketAttributeCommand) { return(((RocketAttributeCommand)command).Method.ReflectedType.FullName); } else { return(command.GetType().FullName); } }
private string getCommandClass(IRocketCommand command) { if (command is RocketAttributeCommand) { return ((RocketAttributeCommand)command).Method.ReflectedType.FullName; } else { return command.GetType().FullName; } }
public void Execute(IRocketPlayer caller, string[] command) { if (command.Length == 0) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("[Vanilla]"); Console.ForegroundColor = ConsoleColor.White; Commander.commands.OrderBy(c => c.command).All(c => { Console.WriteLine(c.command.ToLower().PadRight(20, ' ') + " " + c.info.Replace(c.command, "").TrimStart().ToLower()); return(true); }); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("[Rocket]"); Console.ForegroundColor = ConsoleColor.White; R.Commands.Commands.Where(c => c.GetType().Assembly == Assembly.GetExecutingAssembly()).OrderBy(c => c.Name).All(c => { Console.WriteLine(c.Name.ToLower().PadRight(20, ' ') + " " + c.Syntax.ToLower()); return(true); }); Console.WriteLine(); for (int i = 0; i < R.Plugins.GetPlugins().Count; i++) { IRocketPlugin plugin = R.Plugins.GetPlugins()[i]; Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("[" + plugin.GetType().Assembly.GetName().Name + "]"); Console.ForegroundColor = ConsoleColor.White; R.Commands.Commands.Where(c => c.GetType().Assembly == plugin.GetType().Assembly).OrderBy(c => c.Name).All(c => { Console.WriteLine(c.Name.ToLower().PadRight(20, ' ') + " " + c.Syntax.ToLower()); return(true); }); Console.WriteLine(); } } else { IRocketCommand cmd = R.Commands.Commands.Where(c => (String.Compare(c.Name, command[0], true) == 0)).FirstOrDefault(); if (cmd != null) { string commandName = cmd.GetType().Assembly.GetName().Name + " / " + cmd.Name; Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("[" + commandName + "]"); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(cmd.Name + "\t\t" + cmd.Syntax); Console.WriteLine(cmd.Help); } } }
public void Deregister(IRocketCommand command) { Logger.Log("Deregister " + command.GetType().FullName + " as " + command.Name); commands.Remove(command); }
public void Deregister(IRocketCommand command) { Logger.Log("Deregister " + command.GetType().FullName + " as " + command.Name); commands.Remove(command); }