Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
HelpTopicFactory.java
1 package org.bukkit.help;
2 
4 
5 /**
6  * A HelpTopicFactory is used to create custom {@link HelpTopic} objects from
7  * commands that inherit from a common base class or have executors that
8  * inherit from a common base class. You can use a custom HelpTopic to change
9  * the way all the commands in your plugin display in the help. If your plugin
10  * implements a complex permissions system, a custom help topic may also be
11  * appropriate.
12  * <p>
13  * To automatically bind your plugin's commands to your custom HelpTopic
14  * implementation, first make sure all your commands or executors derive from
15  * a custom base class (it doesn't have to do anything). Next implement a
16  * custom HelpTopicFactory that accepts your custom command base class and
17  * instantiates an instance of your custom HelpTopic from it. Finally,
18  * register your HelpTopicFactory against your command base class using the
19  * {@link HelpMap#registerHelpTopicFactory(Class, HelpTopicFactory)} method.
20  * <p>
21  * As the help system iterates over all registered commands to make help
22  * topics, it first checks to see if there is a HelpTopicFactory registered
23  * for the command's base class. If so, the factory is used to make a help
24  * topic rather than a generic help topic. If no factory is found for the
25  * command's base class and the command derives from {@link
26  * org.bukkit.command.PluginCommand}, then the type of the command's executor
27  * is inspected looking for a registered HelpTopicFactory. Finally, if no
28  * factory is found, a generic help topic is created for the command.
29  *
30  * @param <TCommand> The base class for your custom commands.
31  */
32 public interface HelpTopicFactory<TCommand extends Command> {
33  /**
34  * This method accepts a command deriving from a custom command base class
35  * and constructs a custom HelpTopic for it.
36  *
37  * @param command The custom command to build a help topic for.
38  * @return A new custom help topic or {@code null} to intentionally NOT
39  * create a topic.
40  */
41  public HelpTopic createTopic(TCommand command);
42 }
HelpTopic createTopic(TCommand command)