From 41c45c23425601d6912804dd4b6bba5bbe4686ad Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Thu, 15 Mar 2012 02:27:35 -0400 Subject: [PATCH] [Bleeding] Added automatically generated plugin-level sub-indexes to the master help index. Addresses BUKKIT-1180 By: rmichela --- .../java/org/bukkit/command/PluginCommand.java | 2 +- .../command/PluginIdentifiableCommand.java | 18 ++++++++++++++++++ .../src/main/java/org/bukkit/help/HelpMap.java | 8 ++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 paper-api/src/main/java/org/bukkit/command/PluginIdentifiableCommand.java diff --git a/paper-api/src/main/java/org/bukkit/command/PluginCommand.java b/paper-api/src/main/java/org/bukkit/command/PluginCommand.java index 67597d32c6..05975c7f63 100644 --- a/paper-api/src/main/java/org/bukkit/command/PluginCommand.java +++ b/paper-api/src/main/java/org/bukkit/command/PluginCommand.java @@ -5,7 +5,7 @@ import org.bukkit.plugin.Plugin; /** * Represents a {@link Command} belonging to a plugin */ -public final class PluginCommand extends Command { +public final class PluginCommand extends Command implements PluginIdentifiableCommand { private final Plugin owningPlugin; private CommandExecutor executor; diff --git a/paper-api/src/main/java/org/bukkit/command/PluginIdentifiableCommand.java b/paper-api/src/main/java/org/bukkit/command/PluginIdentifiableCommand.java new file mode 100644 index 0000000000..c58abb6617 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/command/PluginIdentifiableCommand.java @@ -0,0 +1,18 @@ +package org.bukkit.command; + +import org.bukkit.plugin.Plugin; + +/** + * This interface is used by the help system to group commands into sub-indexes based + * on the {@link Plugin} they are a part of. Custom command implementations will need to + * implement this interface to have a sub-index automatically generated on the plugin's + * behalf. + */ +public interface PluginIdentifiableCommand { + /** + * Gets the owner of this PluginIdentifiableCommand. + * + * @return Plugin that owns this PluginIdentifiableCommand. + */ + public Plugin getPlugin(); +} diff --git a/paper-api/src/main/java/org/bukkit/help/HelpMap.java b/paper-api/src/main/java/org/bukkit/help/HelpMap.java index 9441baa723..a293633f65 100644 --- a/paper-api/src/main/java/org/bukkit/help/HelpMap.java +++ b/paper-api/src/main/java/org/bukkit/help/HelpMap.java @@ -1,5 +1,6 @@ package org.bukkit.help; +import java.util.Collection; import java.util.List; /** @@ -20,6 +21,13 @@ public interface HelpMap { */ public HelpTopic getHelpTopic(String topicName); + /** + * Returns a collection of all the registered help topics. + * + * @return All the registered help topics. + */ + public Collection getHelpTopics(); + /** * Adds a topic to the server's help index. *