private static void AddCommand(LifeCommand c) { if (_commands.Count > 0) _allCommands.Append(", "); _allCommands.Append(c.Names[0]); foreach (string name in c.Names) _commands.Add(name.ToLower(), c); }
private static void AddCommand(LifeCommand c) { if (_commands.Count > 0) { _allCommands.Append(", "); } _allCommands.Append(c.Names[0]); foreach (string name in c.Names) { _commands.Add(name.ToLower(), c); } }
private static string AliasesStr(LifeCommand cmd) { if (cmd.Names.Length < 2) { return(""); } StringBuilder sb = new StringBuilder("&hAliases: "); for (int i = 1; i < cmd.Names.Length; ++i) { if (i > 1) { sb.Append(", "); } sb.Append(cmd.Names[i]); } return(sb.Append(".").ToString()); }
private static void OnHelp(Player p, Command cmd) { string cOrP = cmd.Next(); if (String.IsNullOrWhiteSpace(cOrP)) { p.Message("&hLife commands are: " + AllCommands.ToString() + ".\n" + "Type '/life help <command|param> for detailed command or param info." + "Type '/life help set' for the list of parameters."); return; } LifeCommand c = null; Param param = null; string help = String.Empty; if (!Commands.TryGetValue(cOrP.ToLower(), out c)) { if (!Params.TryGetValue(cOrP.ToLower(), out param)) { p.Message("&WUnknown life command/parameter " + cOrP + ". &hType '/life help' for the list of commands."); return; } help = param.Help; } else { help = AliasesStr(c) + c.Help; } p.Message(help); }
private static string AliasesStr(LifeCommand cmd) { if (cmd.Names.Length < 2) return ""; StringBuilder sb = new StringBuilder("&hAliases: "); for (int i=1; i<cmd.Names.Length; ++i) { if (i > 1) sb.Append(", "); sb.Append(cmd.Names[i]); } return sb.Append(".").ToString(); }