Added string[] HelpDesc to Command. Can be used optionally by devs to create a multi-line, detailed version of HelpText. If HelpDesc is given a value, the command's HelpText won't show.

This commit is contained in:
Enerdy 2014-03-08 00:40:36 +00:00
parent 0f3156b4ac
commit a6f6af2499

View file

@ -70,6 +70,10 @@ namespace TShockAPI
/// </summary> /// </summary>
public string HelpText { get; set; } public string HelpText { get; set; }
/// <summary> /// <summary>
/// Gets or sets an extended description of this command.
/// </summary>
public string[] HelpDesc { get; set; }
/// <summary>
/// Gets the name of the command. /// Gets the name of the command.
/// </summary> /// </summary>
public string Name { get { return Names[0]; } } public string Name { get { return Names[0]; } }
@ -118,6 +122,7 @@ namespace TShockAPI
CommandDelegate = cmd; CommandDelegate = cmd;
DoLog = true; DoLog = true;
HelpText = "No help available."; HelpText = "No help available.";
HelpDesc = null;
Names = new List<string>(names); Names = new List<string>(names);
Permissions = new List<string>(); Permissions = new List<string>();
} }
@ -3608,7 +3613,15 @@ namespace TShockAPI
} }
args.Player.SendSuccessMessage("/{0} help: ", command.Name); args.Player.SendSuccessMessage("/{0} help: ", command.Name);
if (command.HelpDesc == null)
{
args.Player.SendInfoMessage(command.HelpText); args.Player.SendInfoMessage(command.HelpText);
return;
}
foreach (string line in command.HelpDesc)
{
args.Player.SendInfoMessage(line);
}
} }
} }