feat(gui): make help book commands clickable

This commit is contained in:
2026-02-04 22:13:55 -05:00
parent 02c53849cf
commit 37cb4453ac

View File

@@ -2,6 +2,8 @@ package party.cybsec.oyeshops.gui;
import net.kyori.adventure.inventory.Book; import net.kyori.adventure.inventory.Book;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration; import net.kyori.adventure.text.format.TextDecoration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -30,7 +32,10 @@ public class HelpBook {
.append(Component.text("steps to start:", NamedTextColor.GRAY)) .append(Component.text("steps to start:", NamedTextColor.GRAY))
.append(Component.newline()) .append(Component.newline())
.append(Component.text("1. type ", NamedTextColor.BLACK)) .append(Component.text("1. type ", NamedTextColor.BLACK))
.append(Component.text("/oyes on", NamedTextColor.BLUE)) .append(Component.text("/oyes on", NamedTextColor.BLUE)
.clickEvent(ClickEvent.runCommand("/oyes on"))
.hoverEvent(HoverEvent.showText(Component.text("click to enable shops",
NamedTextColor.GRAY))))
.append(Component.newline()) .append(Component.newline())
.append(Component.text("2. place a chest", NamedTextColor.BLACK)) .append(Component.text("2. place a chest", NamedTextColor.BLACK))
.append(Component.newline()) .append(Component.newline())
@@ -48,7 +53,10 @@ public class HelpBook {
.append(Component.text("1. look at a sign", NamedTextColor.GRAY)) .append(Component.text("1. look at a sign", NamedTextColor.GRAY))
.append(Component.newline()) .append(Component.newline())
.append(Component.text("2. type ", NamedTextColor.GRAY)) .append(Component.text("2. type ", NamedTextColor.GRAY))
.append(Component.text("/oyes setup", NamedTextColor.BLUE)) .append(Component.text("/oyes setup", NamedTextColor.BLUE)
.clickEvent(ClickEvent.runCommand("/oyes setup"))
.hoverEvent(HoverEvent.showText(Component.text("click to start wizard",
NamedTextColor.GRAY))))
.append(Component.newline()) .append(Component.newline())
.append(Component.newline()) .append(Component.newline())
.append(Component.text("...or turn the page", NamedTextColor.DARK_GRAY)) .append(Component.text("...or turn the page", NamedTextColor.DARK_GRAY))
@@ -142,12 +150,18 @@ public class HelpBook {
.append(Component.text("commands", NamedTextColor.GOLD, TextDecoration.BOLD)) .append(Component.text("commands", NamedTextColor.GOLD, TextDecoration.BOLD))
.append(Component.newline()) .append(Component.newline())
.append(Component.newline()) .append(Component.newline())
.append(Component.text("/oyes notify", NamedTextColor.BLUE)) .append(Component.text("/oyes notify", NamedTextColor.BLUE)
.clickEvent(ClickEvent.runCommand("/oyes notify"))
.hoverEvent(HoverEvent.showText(Component.text("click to toggle alerts",
NamedTextColor.GRAY))))
.append(Component.newline()) .append(Component.newline())
.append(Component.text("get low stock alerts.", NamedTextColor.DARK_GRAY)) .append(Component.text("get low stock alerts.", NamedTextColor.DARK_GRAY))
.append(Component.newline()) .append(Component.newline())
.append(Component.newline()) .append(Component.newline())
.append(Component.text("/oyes info", NamedTextColor.BLUE)) .append(Component.text("/oyes info", NamedTextColor.BLUE)
.clickEvent(ClickEvent.runCommand("/oyes info"))
.hoverEvent(HoverEvent.showText(
Component.text("click for info", NamedTextColor.GRAY))))
.append(Component.newline()) .append(Component.newline())
.append(Component.text("plugin info.", NamedTextColor.DARK_GRAY)) .append(Component.text("plugin info.", NamedTextColor.DARK_GRAY))
.build()); .build());