Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.help.HelpTopic Class Referenceabstract
Inheritance diagram for org.bukkit.help.HelpTopic:
org.bukkit.help.GenericCommandHelpTopic org.bukkit.help.IndexHelpTopic

Public Member Functions

abstract boolean canSee (CommandSender player)
void amendCanSee (String amendedPermission)
String getName ()
String getShortText ()
String getFullText (CommandSender forWho)
void amendTopic (String amendedShortText, String amendedFullText)

Protected Member Functions

String applyAmendment (String baseText, String amendment)

Protected Attributes

String name
String shortText
String fullText
String amendedPermission

Detailed Description

HelpTopic implementations are displayed to the user when the user uses the /help command.

Custom implementations of this class can work at two levels. A simple implementation only needs to set the value of




, and


in the constructor. This base class will take care of the rest.

Complex implementations can be created by overriding the behavior of all the methods in this class.

Definition at line 18 of file HelpTopic.java.

Member Function Documentation

void org.bukkit.help.HelpTopic.amendCanSee ( String  amendedPermission)

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.

amendedPermissionThe permission node the server administrator wishes to apply to this topic.

Definition at line 46 of file HelpTopic.java.

46  {
47  this.amendedPermission = amendedPermission;
48  }
void org.bukkit.help.HelpTopic.amendTopic ( String  amendedShortText,
String  amendedFullText 

Allows the server admin (or another plugin) to add or replace the contents of a help topic.

A null in either parameter will leave that part of the topic unchanged. In either amending parameter, the string { <text>} is replaced with the existing contents in the help topic. Use this to append or prepend additional content into an automatically generated help topic.

amendedShortTextThe new topic short text to use, or null to leave alone.
amendedFullTextThe new topic full text to use, or null to leave alone.

Definition at line 98 of file HelpTopic.java.

References org.bukkit.help.HelpTopic.applyAmendment().

98  {
99  shortText = applyAmendment(shortText, amendedShortText);
100  fullText = applyAmendment(fullText, amendedFullText);
101  }
String applyAmendment(String baseText, String amendment)
Definition: HelpTopic.java:114
String org.bukkit.help.HelpTopic.applyAmendment ( String  baseText,
String  amendment 

Developers implementing their own custom HelpTopic implementations can use this utility method to ensure their implementations comply with the expected behavior of the HelpTopic#amendTopic(String, String) method.

baseTextThe existing text of the help topic.
amendmentThe amending text from the amendTopic() method.
The application of the amending text to the existing text, according to the expected rules of amendTopic().

Definition at line 114 of file HelpTopic.java.

Referenced by org.bukkit.help.HelpTopic.amendTopic().

114  {
115  if (amendment == null) {
116  return baseText;
117  } else {
118  return amendment.replaceAll("<text>", baseText);
119  }
120  }
abstract boolean org.bukkit.help.HelpTopic.canSee ( CommandSender  player)

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.

playerThe Player in question.
True of the Player can see this help topic, false otherwise.
String org.bukkit.help.HelpTopic.getFullText ( CommandSender  forWho)

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.

forWhoThe player or console requesting the full text. Useful for further security trimming the command's full text based on sub-permissions in custom implementations.
A full topic description.

Definition at line 80 of file HelpTopic.java.

80  {
81  return fullText;
82  }
String org.bukkit.help.HelpTopic.getName ( )

Returns the name of this help topic.

The topic name.

Definition at line 55 of file HelpTopic.java.

Referenced by org.bukkit.help.IndexHelpTopic.buildIndexLine().

55  {
56  return name;
57  }
String org.bukkit.help.HelpTopic.getShortText ( )

Returns a brief description that will be displayed in the topic index.

A brief topic description.

Definition at line 64 of file HelpTopic.java.

Referenced by org.bukkit.help.IndexHelpTopic.buildIndexLine().

64  {
65  return shortText;
66  }

The documentation for this class was generated from the following file: