Package org.bukkit.help
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 Collection<HelpTopic>allTopicsprotected Stringpermissionprotected Stringpreamble-
Fields inherited from class org.bukkit.help.HelpTopic
amendedPermission, fullText, name, shortText
-
-
Constructor Summary
Constructors Constructor Description IndexHelpTopic(@NotNull String name, @Nullable String shortText, @Nullable String permission, @NotNull Collection<HelpTopic> topics)IndexHelpTopic(@NotNull String name, @Nullable String shortText, @Nullable String permission, @NotNull Collection<HelpTopic> topics, @Nullable String preamble)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidamendCanSee(@Nullable String amendedPermission)Allows the server administrator to override the permission required to see a help topic.protected @NotNull StringbuildIndexLine(@NotNull CommandSender sender, @NotNull HelpTopic topic)Builds individual lines in the index topic.protected @NotNull StringbuildPreamble(@NotNull CommandSender sender)Builds the topic preamble.booleancanSee(@NotNull CommandSender sender)Determines if aPlayeris allowed to see this help topic.@NotNull StringgetFullText(@NotNull CommandSender sender)Returns the full description of this help topic that is displayed when the user requests this topic's details.protected voidsetTopicsCollection(@NotNull Collection<HelpTopic> topics)Sets the contents of the internal allTopics collection.-
Methods inherited from class org.bukkit.help.HelpTopic
amendTopic, applyAmendment, getName, getShortText
-
-
-
-
Field Detail
-
permission
protected String permission
-
preamble
protected String preamble
-
allTopics
protected Collection<HelpTopic> allTopics
-
-
Constructor Detail
-
IndexHelpTopic
public IndexHelpTopic(@NotNull @NotNull String name, @Nullable @Nullable String shortText, @Nullable @Nullable String permission, @NotNull @NotNull Collection<HelpTopic> topics)
-
-
Method Detail
-
setTopicsCollection
protected void setTopicsCollection(@NotNull @NotNull Collection<HelpTopic> topics)Sets the contents of the internal allTopics collection.- Parameters:
topics- The topics to set.
-
canSee
public boolean canSee(@NotNull @NotNull CommandSender sender)Description copied from class:HelpTopicDetermines if aPlayeris allowed to see this help topic.HelpTopic implementations should take server administrator wishes into account as set by the
HelpTopic.amendCanSee(String)function.
-
amendCanSee
public void amendCanSee(@Nullable @Nullable String amendedPermission)Description copied from class:HelpTopicAllows 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:
amendCanSeein classHelpTopic- Parameters:
amendedPermission- The permission node the server administrator wishes to apply to this topic.
-
getFullText
@NotNull public @NotNull String getFullText(@NotNull @NotNull CommandSender sender)
Description copied from class:HelpTopicReturns 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:
getFullTextin classHelpTopic- 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
@NotNull protected @NotNull String buildPreamble(@NotNull @NotNull 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
@NotNull protected @NotNull String buildIndexLine(@NotNull @NotNull CommandSender sender, @NotNull @NotNull 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.
-
-