org.bukkit.craftbukkit.help.CustomIndexHelpTopic Maven / Gradle / Ivy
package org.bukkit.craftbukkit.help;
import org.bukkit.command.CommandSender;
import org.bukkit.help.HelpMap;
import org.bukkit.help.HelpTopic;
import org.bukkit.help.IndexHelpTopic;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
/**
*
*/
public class CustomIndexHelpTopic extends IndexHelpTopic {
private final HelpMap helpMap;
private List futureTopics;
public CustomIndexHelpTopic(HelpMap helpMap, String name, String shortText, String permission, List futureTopics, String preamble) {
super(name, shortText, permission, new HashSet(), preamble);
this.helpMap = helpMap;
this.futureTopics = futureTopics;
}
@Override
public String getFullText(CommandSender sender) {
if (futureTopics != null) {
List topics = new LinkedList();
for (String futureTopic : futureTopics) {
HelpTopic topic = helpMap.getHelpTopic(futureTopic);
if (topic != null) {
topics.add(topic);
}
}
setTopicsCollection(topics);
futureTopics = null;
}
return super.getFullText(sender);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy