1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

[CI skip] Added /sf search suggestion to the book interface

This commit is contained in:
TheBusyBiscuit 2020-04-05 18:02:45 +02:00
parent af4de4fd10
commit 8011956459
2 changed files with 7 additions and 1 deletions

View File

@ -54,6 +54,7 @@
* Added experimental 1.13 backwards compatibility
* Added "Magma Cream to Magma Blocks" recipe to the Electric Press
* Added "Magma Blocks to Sulfate" recipe
* You can now search for items from within the book variant of the Guide
#### Changes
* Replaced GuideHandlers with FlexCategories

View File

@ -12,6 +12,7 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
import io.github.thebusybiscuit.cscorelib2.chat.json.ChatComponent;
import io.github.thebusybiscuit.cscorelib2.chat.json.ClickEvent;
import io.github.thebusybiscuit.cscorelib2.chat.json.ClickEventAction;
import io.github.thebusybiscuit.cscorelib2.chat.json.CustomBookInterface;
import io.github.thebusybiscuit.cscorelib2.chat.json.HoverEvent;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
@ -23,6 +24,7 @@ import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.LockedCategory;
@ -47,7 +49,9 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
book.setTitle(SlimefunPlugin.getLocal().getMessage(p, "guide.title.main"));
for (int i = 0; i < lines.size(); i = i + 10) {
ChatComponent page = new ChatComponent(ChatColors.color("&b&l- Slimefun Guide -\n\n"));
ChatComponent page = new ChatComponent(ChatColors.color("&b&l- " + SlimefunPlugin.getLocal().getMessage(p, "guide.title.main") + " -\n\n"));
page.setHoverEvent(new HoverEvent(ChestMenuUtils.getSearchButton(p)));
page.setClickEvent(new ClickEvent(ClickEventAction.SUGGEST_COMMAND, "/sf search "));
for (int j = i; j < lines.size() && j < i + 10; j++) {
page.append(lines.get(j));
@ -195,6 +199,7 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
@Override
public void openSearch(PlayerProfile profile, String input, boolean addToHistory) {
// We need to write a book implementation for this at some point
SlimefunGuide.openSearch(profile, input, true, addToHistory);
}