diff options
author | rmichela <deltahat@gmail.com> | 2012-03-14 23:38:59 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-03-16 02:42:12 -0400 |
commit | 494c913fef61e416e30e2d095a7187e6a80e9b69 (patch) | |
tree | 92400ac8b416e0f82ccd2e2c105aa5e855d392c4 | |
parent | 4507bd922f908e269225e710fa395ce6f0d323a8 (diff) | |
download | bukkit-494c913fef61e416e30e2d095a7187e6a80e9b69.tar bukkit-494c913fef61e416e30e2d095a7187e6a80e9b69.tar.gz bukkit-494c913fef61e416e30e2d095a7187e6a80e9b69.tar.lz bukkit-494c913fef61e416e30e2d095a7187e6a80e9b69.tar.xz bukkit-494c913fef61e416e30e2d095a7187e6a80e9b69.zip |
[Bleeding] Added option to remove entire plugins from the help index using the help.yml file. Addresses BUKKIT-1178
7 files changed, 35 insertions, 8 deletions
diff --git a/src/main/java/org/bukkit/command/defaults/BukkitCommand.java b/src/main/java/org/bukkit/command/defaults/BukkitCommand.java new file mode 100644 index 00000000..d3de7c8b --- /dev/null +++ b/src/main/java/org/bukkit/command/defaults/BukkitCommand.java @@ -0,0 +1,15 @@ +package org.bukkit.command.defaults; + +import org.bukkit.command.Command; + +import java.util.List; + +public abstract class BukkitCommand extends Command{ + protected BukkitCommand(String name) { + super(name); + } + + protected BukkitCommand(String name, String description, String usageMessage, List<String> aliases) { + super(name, description, usageMessage, aliases); + } +} diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java index 2efe30e8..918b08ad 100644 --- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java +++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java @@ -7,7 +7,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.plugin.Plugin; -public class PluginsCommand extends Command { +public class PluginsCommand extends BukkitCommand { public PluginsCommand(String name) { super(name); this.description = "Gets a list of plugins running on the server"; diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java index 702762a4..6abd323f 100644 --- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java +++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java @@ -6,7 +6,7 @@ import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; -public class ReloadCommand extends Command { +public class ReloadCommand extends BukkitCommand { public ReloadCommand(String name) { super(name); this.description = "Reloads the server configuration and plugins"; diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java index 9e5b6769..b9c8fc66 100644 --- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java +++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java @@ -14,7 +14,7 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.RegisteredListener; import org.bukkit.plugin.TimedRegisteredListener; -public class TimingsCommand extends Command { +public class TimingsCommand extends BukkitCommand { public TimingsCommand(String name) { super(name); this.description = "Records timings for all plugin events"; diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java index 0bd5c5af..4dc7a076 100644 --- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java +++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java @@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; -public class VersionCommand extends Command { +public class VersionCommand extends BukkitCommand { public VersionCommand(String name) { super(name); diff --git a/src/main/java/org/bukkit/help/HelpMap.java b/src/main/java/org/bukkit/help/HelpMap.java index 6e4fc79c..9441baa7 100644 --- a/src/main/java/org/bukkit/help/HelpMap.java +++ b/src/main/java/org/bukkit/help/HelpMap.java @@ -1,9 +1,11 @@ package org.bukkit.help; +import java.util.List; + /** * The HelpMap tracks all help topics registered in a Bukkit server. When the server starts up or is reloaded, * help is processed and topics are added in the following order: - * + * <p/> * 1. General topics are loaded from the help.yml * 2. Plugins load and optionally call {@code addTopic()} * 3. Registered plugin commands are processed by {@link HelpTopicFactory} objects to create topics @@ -38,9 +40,19 @@ public interface HelpMap { * derives from {@code commandClass} base class. * * @param commandClass The class for which the custom HelpTopicFactory applies. Must derive from - * either {@link org.bukkit.command.Command} or {@link org.bukkit.command.CommandExecutor}. - * @param factory The {@link HelpTopicFactory} implementation to associate with the {@code commandClass}. + * either {@link org.bukkit.command.Command} or {@link org.bukkit.command.CommandExecutor}. + * @param factory The {@link HelpTopicFactory} implementation to associate with the {@code commandClass}. * @throws IllegalArgumentException Thrown if {@code commandClass} does not derive from a legal base class. */ public void registerHelpTopicFactory(Class<?> commandClass, HelpTopicFactory<?> factory); + + /** + * Gets the list of plugins the server administrator has chosen to exclude from the help index. Plugin authors + * who choose to directly extend {@link org.bukkit.command.Command} instead of {@link org.bukkit.command.PluginCommand} + * will need to check this collection in their {@link HelpTopicFactory} implementations to ensure they meet the + * server administrator's expectations. + * + * @return A list of plugins that should be excluded from the help index. + */ + public List<String> getIgnoredPlugins(); } diff --git a/src/main/java/org/bukkit/help/HelpTopicFactory.java b/src/main/java/org/bukkit/help/HelpTopicFactory.java index 665372ff..e1901382 100644 --- a/src/main/java/org/bukkit/help/HelpTopicFactory.java +++ b/src/main/java/org/bukkit/help/HelpTopicFactory.java @@ -28,7 +28,7 @@ public interface HelpTopicFactory<TCommand extends Command> { * for it. * * @param command The custom command to build a help topic for. - * @return A new custom help topic. + * @return A new custom help topic or {@code null} to intentionally NOT create a topic. */ public HelpTopic createTopic(TCommand command); } |