Help commands
This page explains how to create help commands in Lamp
Including Help Interfaces in Command Methods
Help.RelatedCommandsPurpose: Use this interface to include all child and sibling commands. This is ideal for providing a complete help menu that encompasses all relevant commands at the same level or below.
Usage: Add
Help.RelatedCommandsas a parameter in your command method. This will provide the combined list of both child and sibling commands.
private static final int ENTRIES_PER_PAGE = 7;
@Command("myplugin help")
public void sendHelpMenu(
BukkitCommandActor actor,
@Range(min = 1) @Default("1") int page,
Help.RelatedCommands<BukkitCommandActor> commands
) {
var list = commands.paginate(page, ENTRIES_PER_PAGE);
for (var command : list) {
actor.reply("- " + command.usage());
}
}private const val ENTRIES_PER_PAGE = 7
@Command("myplugin help")
fun sendHelpMenu(
actor: BukkitCommandActor,
@Range(min = 1) @Optional page: Int = 1,
commands: Help.RelatedCommands<BukkitCommandActor>
) {
val list = commands.paginate(page, ENTRIES_PER_PAGE)
for (command in list) {
actor.reply("- ${command.usage()}")
}
}Help.ChildrenCommandsPurpose: Use this interface to include all child commands associated with a specific command. This is useful for displaying commands that fall under a parent command, creating a hierarchical help menu.
Usage: Add
Help.ChildrenCommandsas a parameter in your command method. This will automatically provide the list of child commands for the current command.
Help.SiblingCommandsPurpose: Use this interface to include all sibling commands that are on the same level as the current command. This is useful for showing related commands that are at the same command hierarchy level.
Usage: Add
Help.SiblingCommandsas a parameter in your command method. This will automatically provide the list of sibling commands for the current command.
Last updated
Was this helpful?