1 package org.bukkit.help;
9 import java.util.Collection;
21 protected String permission;
22 protected String preamble;
23 protected Collection<HelpTopic> allTopics;
25 public IndexHelpTopic(String name, String shortText, String permission, Collection<HelpTopic> topics) {
26 this(name, shortText, permission, topics, null);
29 public IndexHelpTopic(String name, String shortText, String permission, Collection<HelpTopic> topics, String preamble) {
31 this.shortText = shortText;
32 this.permission = permission;
33 this.preamble = preamble;
43 this.allTopics = topics;
50 if (permission == null) {
57 public void amendCanSee(String amendedPermission) {
58 permission = amendedPermission;
61 public String getFullText(CommandSender sender) {
62 StringBuilder sb =
new StringBuilder();
64 if (preamble != null) {
69 for (HelpTopic topic : allTopics) {
70 if (topic.canSee(sender)) {
71 String lineStr =
buildIndexLine(sender, topic).replace(
"\n",
". ");
72 if (sender instanceof Player && lineStr.length() > ChatPaginator.GUARANTEED_NO_WRAP_CHAT_PAGE_WIDTH) {
73 sb.append(lineStr.substring(0, ChatPaginator.GUARANTEED_NO_WRAP_CHAT_PAGE_WIDTH - 3));
104 StringBuilder line =
new StringBuilder();
110 return line.toString();
boolean hasPermission(String name)
String buildPreamble(CommandSender sender)
void setTopicsCollection(Collection< HelpTopic > topics)
String buildIndexLine(CommandSender sender, HelpTopic topic)