Class IndexHelpTopic

java.lang.Object
org.bukkit.help.HelpTopic
org.bukkit.help.IndexHelpTopic

public class IndexHelpTopic
extends HelpTopic
This help topic generates a list of other help topics. This class is useful for adding your own index help topics. To enforce a particular order, use a sorted collection.

If a preamble is provided to the constructor, that text will be displayed before the first item in the index.

  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.Collection<HelpTopic> allTopics  
    protected java.lang.String permission  
    protected java.lang.String preamble  

    Fields inherited from class org.bukkit.help.HelpTopic

    amendedPermission, fullText, name, shortText
  • Constructor Summary

    Constructors 
    Constructor Description
    IndexHelpTopic​(java.lang.String name, java.lang.String shortText, java.lang.String permission, java.util.Collection<HelpTopic> topics)  
    IndexHelpTopic​(java.lang.String name, java.lang.String shortText, java.lang.String permission, java.util.Collection<HelpTopic> topics, java.lang.String preamble)  
  • Method Summary

    Modifier and Type Method Description
    void amendCanSee​(java.lang.String amendedPermission)
    Allows the server administrator to override the permission required to see a help topic.
    protected java.lang.String buildIndexLine​(CommandSender sender, HelpTopic topic)
    Builds individual lines in the index topic.
    protected java.lang.String buildPreamble​(CommandSender sender)
    Builds the topic preamble.
    boolean canSee​(CommandSender sender)
    Determines if a Player is allowed to see this help topic.
    java.lang.String getFullText​(CommandSender sender)
    Returns the full description of this help topic that is displayed when the user requests this topic's details.
    protected void setTopicsCollection​(java.util.Collection<HelpTopic> topics)
    Sets the contents of the internal allTopics collection.

    Methods inherited from class org.bukkit.help.HelpTopic

    amendTopic, applyAmendment, getName, getShortText

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • IndexHelpTopic

      public IndexHelpTopic​(java.lang.String name, java.lang.String shortText, java.lang.String permission, java.util.Collection<HelpTopic> topics)
    • IndexHelpTopic

      public IndexHelpTopic​(java.lang.String name, java.lang.String shortText, java.lang.String permission, java.util.Collection<HelpTopic> topics, java.lang.String preamble)
  • Method Details

    • setTopicsCollection

      protected void setTopicsCollection​(java.util.Collection<HelpTopic> topics)
      Sets the contents of the internal allTopics collection.
      Parameters:
      topics - The topics to set.
    • canSee

      public boolean canSee​(CommandSender sender)
      Description copied from class: HelpTopic
      Determines if a Player is allowed to see this help topic.

      HelpTopic implementations should take server administrator wishes into account as set by the HelpTopic.amendCanSee(String) function.

      Specified by:
      canSee in class HelpTopic
      Parameters:
      sender - The Player in question.
      Returns:
      True of the Player can see this help topic, false otherwise.
    • amendCanSee

      public void amendCanSee​(java.lang.String amendedPermission)
      Description copied from class: HelpTopic
      Allows the server administrator to override the permission required to see a help topic.

      HelpTopic implementations should take this into account when determining topic visibility on the HelpTopic.canSee(org.bukkit.command.CommandSender) function.

      Overrides:
      amendCanSee in class HelpTopic
      Parameters:
      amendedPermission - The permission node the server administrator wishes to apply to this topic.
    • getFullText

      public java.lang.String getFullText​(CommandSender sender)
      Description copied from class: HelpTopic
      Returns the full description of this help topic that is displayed when the user requests this topic's details.

      The result will be paginated to properly fit the user's client.

      Overrides:
      getFullText in class HelpTopic
      Parameters:
      sender - The player or console requesting the full text. Useful for further security trimming the command's full text based on sub-permissions in custom implementations.
      Returns:
      A full topic description.
    • buildPreamble

      protected java.lang.String buildPreamble​(CommandSender sender)
      Builds the topic preamble. Override this method to change how the index preamble looks.
      Parameters:
      sender - The command sender requesting the preamble.
      Returns:
      The topic preamble.
    • buildIndexLine

      protected java.lang.String buildIndexLine​(CommandSender sender, HelpTopic topic)
      Builds individual lines in the index topic. Override this method to change how index lines are rendered.
      Parameters:
      sender - The command sender requesting the index line.
      topic - The topic to render into an index line.
      Returns:
      The rendered index line.