Skip to content

Commit f2f589b

Browse files
committed
feat(wiki): register FluffyMachines' own in-game wiki page
1 parent ad401d0 commit f2f589b

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/main/java/io/ncbpfluffybear/fluffymachines/FluffyMachines.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public void onEnable() {
103103

104104
// Contribute this addon's per-language item translations (languages/<lang>/items.yml).
105105
Slimefun.getItemTranslationService().registerTranslations(this);
106+
registerWiki();
106107

107108
// Register Events Class
108109
getServer().getPluginManager().registerEvents(new Events(), this);
@@ -119,6 +120,21 @@ public void onDisable() {
119120
// Logic for disabling the plugin...
120121
}
121122

123+
private void registerWiki() {
124+
io.github.thebusybiscuit.slimefun5.core.guide.wiki.WikiText wiki = io.github.thebusybiscuit.slimefun5.implementation.Slimefun.getWikiText();
125+
String topicId = "addon_fluffymachines";
126+
wiki.registerTopic(new io.github.thebusybiscuit.slimefun5.core.guide.wiki.WikiTopic(topicId, "Fluffy Machines", io.github.thebusybiscuit.slimefun5.libraries.xseries.XMaterial.PISTON, "&7Quality-of-life machines"));
127+
wiki.setMechanic(topicId, java.util.Arrays.asList(
128+
"&7Quality-of-life machines.", "",
129+
"&7Auto crafters, storage barrels, ender-chest", "&7links and handy utility machines that", "&7streamline your automation.", "",
130+
"&7Click an item below for its recipe."));
131+
java.util.List<String> items = new java.util.ArrayList<>();
132+
for (io.github.thebusybiscuit.slimefun5.api.items.SlimefunItem item : io.github.thebusybiscuit.slimefun5.implementation.Slimefun.getRegistry().getEnabledSlimefunItems()) {
133+
try { if (item.getAddon() == this) { items.add(item.getId()); } } catch (Exception | LinkageError ignored) { }
134+
}
135+
wiki.setTopicItems(topicId, items);
136+
}
137+
122138
@Override
123139
public boolean onCommand(@Nonnull CommandSender sender, @Nonnull Command cmd, @Nonnull String label, String[] args) {
124140

0 commit comments

Comments
 (0)