mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-25 10:29:41 -05:00
[Bleeding] Added support for custom index help topics in help.yml. Addresses BUKKIT-1263
This commit is contained in:
1 parent
eb3c092ef8
commit
0a925ff067
4 files changed
+99
-11
No files matched your search
@@ -0,0 +1,40 @@
|
||||
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 List<String> futureTopics;
|
||||
private HelpMap helpMap;
|
||||
|
||||
public CustomIndexHelpTopic(HelpMap helpMap, String name, String shortText, String permission, List<String> futureTopics, String preamble) {
|
||||
super(name, shortText, permission, new HashSet<HelpTopic>(), preamble);
|
||||
this.helpMap = helpMap;
|
||||
this.futureTopics = futureTopics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullText(CommandSender sender) {
|
||||
if (futureTopics != null) {
|
||||
List<HelpTopic> topics = new LinkedList<HelpTopic>();
|
||||
for (String futureTopic : futureTopics) {
|
||||
HelpTopic topic = helpMap.getHelpTopic(futureTopic);
|
||||
if (topic != null) {
|
||||
topics.add(topic);
|
||||
}
|
||||
}
|
||||
setTopicsCollection(topics);
|
||||
futureTopics = null;
|
||||
}
|
||||
|
||||
return super.getFullText(sender);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user