diff --git a/src/main/java/party/cybsec/oyeshops/gui/HelpBook.java b/src/main/java/party/cybsec/oyeshops/gui/HelpBook.java index 4b9b26a..9f4ed6b 100644 --- a/src/main/java/party/cybsec/oyeshops/gui/HelpBook.java +++ b/src/main/java/party/cybsec/oyeshops/gui/HelpBook.java @@ -32,10 +32,12 @@ public class HelpBook { .append(Component.text("1. type ", NamedTextColor.BLACK)) .append(Component.text("/oyes on", NamedTextColor.BLUE)) .append(Component.newline()) + .append(Component.text("2. place a chest", NamedTextColor.BLACK)) + .append(Component.newline()) .append(Component.text("3. place a wall sign", NamedTextColor.BLACK)) .build()); - // page 2: setup wizard + // page 2: setup wizard (intro) pages.add(Component.text() .append(Component.text("setup wizard", NamedTextColor.GOLD, TextDecoration.BOLD)) .append(Component.newline()) @@ -49,7 +51,15 @@ public class HelpBook { .append(Component.text("/oyes setup", NamedTextColor.BLUE)) .append(Component.newline()) .append(Component.newline()) - .append(Component.text("or just write ", NamedTextColor.GRAY)) + .append(Component.text("...or turn the page", NamedTextColor.DARK_GRAY)) + .build()); + + // page 3: setup wizard (sign trigger) + pages.add(Component.text() + .append(Component.text("sign trigger", NamedTextColor.GOLD, TextDecoration.BOLD)) + .append(Component.newline()) + .append(Component.newline()) + .append(Component.text("just write ", NamedTextColor.GRAY)) .append(Component.text("setup", NamedTextColor.BLUE, TextDecoration.BOLD)) .append(Component.text(" on the first line of the sign.", NamedTextColor.GRAY)) .append(Component.newline()) @@ -59,13 +69,12 @@ public class HelpBook { NamedTextColor.DARK_GRAY)) .build()); - // page 2: the sign format + // page 4: manual creation pages.add(Component.text() - .append(Component.text("creating a shop", NamedTextColor.GOLD, TextDecoration.BOLD)) + .append(Component.text("manual setup", NamedTextColor.GOLD, TextDecoration.BOLD)) .append(Component.newline()) .append(Component.newline()) - .append(Component.text("write your trade on the sign like this:", - NamedTextColor.DARK_GRAY)) + .append(Component.text("write exactly this:", NamedTextColor.DARK_GRAY)) .append(Component.newline()) .append(Component.newline()) .append(Component.text("line 1: ", NamedTextColor.GRAY)) @@ -76,18 +85,14 @@ public class HelpBook { .append(Component.newline()) .append(Component.text("line 3: ", NamedTextColor.GRAY)) .append(Component.text("64 dirt", NamedTextColor.BLACK)) - .append(Component.newline()) - .append(Component.newline()) - .append(Component.text("(order doesn't matter, it shows a confirmation)", - NamedTextColor.DARK_GRAY)) .build()); - // page 3: auto detection + // page 5: auto detection pages.add(Component.text() .append(Component.text("auto detection", NamedTextColor.GOLD, TextDecoration.BOLD)) .append(Component.newline()) .append(Component.newline()) - .append(Component.text("lazy? just put your items in the chest and write:", + .append(Component.text("lazy? just put items in the chest and write:", NamedTextColor.DARK_GRAY)) .append(Component.newline()) .append(Component.newline()) @@ -96,29 +101,28 @@ public class HelpBook { .append(Component.text("for 10 gold", NamedTextColor.BLACK)) .append(Component.newline()) .append(Component.newline()) - .append(Component.text( - "the plugin will see what's in the chest and fill it in for you.", + .append(Component.text("the plugin will check the chest contents.", NamedTextColor.DARK_GRAY)) .build()); - // page 4: protection and ownership + // page 6: ownership pages.add(Component.text() .append(Component.text("ownership rules", NamedTextColor.GOLD, TextDecoration.BOLD)) .append(Component.newline()) .append(Component.newline()) .append(Component.text( - "to prevent stealing, you can only make shops on containers you placed ", + "you can only make shops on containers you placed ", NamedTextColor.DARK_GRAY)) .append(Component.text("this session", NamedTextColor.BLACK, TextDecoration.ITALIC)) .append(Component.text(".", NamedTextColor.DARK_GRAY)) .append(Component.newline()) .append(Component.newline()) .append(Component.text( - "if the server restarts, you can't turn old chests into shops. place a fresh one!", + "prevents stealing old chests!", NamedTextColor.DARK_GRAY)) .build()); - // page 5: containers + // page 7: containers pages.add(Component.text() .append(Component.text("supported blocks", NamedTextColor.GOLD, TextDecoration.BOLD)) .append(Component.newline()) @@ -130,40 +134,38 @@ public class HelpBook { .append(Component.text("- trapped chests", NamedTextColor.BLACK)) .append(Component.newline()) .append(Component.newline()) - .append(Component.text("double chests are fully supported. both halves are protected.", - NamedTextColor.DARK_GRAY)) + .append(Component.text("double chests supported.", NamedTextColor.DARK_GRAY)) .build()); - // page 6: utility commands + // page 8: commands pages.add(Component.text() - .append(Component.text("handy commands", NamedTextColor.GOLD, TextDecoration.BOLD)) + .append(Component.text("commands", NamedTextColor.GOLD, TextDecoration.BOLD)) .append(Component.newline()) .append(Component.newline()) .append(Component.text("/oyes notify", NamedTextColor.BLUE)) .append(Component.newline()) - .append(Component.text("get alerts when your shops run out of items.", - NamedTextColor.DARK_GRAY)) + .append(Component.text("get low stock alerts.", NamedTextColor.DARK_GRAY)) .append(Component.newline()) .append(Component.newline()) .append(Component.text("/oyes info", NamedTextColor.BLUE)) .append(Component.newline()) - .append(Component.text("see who made this plugin.", NamedTextColor.DARK_GRAY)) + .append(Component.text("plugin info.", NamedTextColor.DARK_GRAY)) .build()); - // page 7: tips + // page 9: tips pages.add(Component.text() .append(Component.text("pro tips", NamedTextColor.GOLD, TextDecoration.BOLD)) .append(Component.newline()) .append(Component.newline()) - .append(Component.text("- use wall signs only.", NamedTextColor.BLACK)) + .append(Component.text("- use wall signs.", NamedTextColor.BLACK)) .append(Component.newline()) - .append(Component.text("- use abbreviations like ", NamedTextColor.BLACK)) + .append(Component.text("- abbreviations: ", NamedTextColor.BLACK)) .append(Component.text("dia", NamedTextColor.BLUE)) - .append(Component.text(" for diamond.", NamedTextColor.BLACK)) + .append(Component.text(" = diamond.", NamedTextColor.BLACK)) .append(Component.newline()) .append(Component.text("- shops are ", NamedTextColor.BLACK)) .append(Component.text("off", NamedTextColor.RED)) - .append(Component.text(" by default to prevent accidents.", NamedTextColor.BLACK)) + .append(Component.text(" by default.", NamedTextColor.BLACK)) .build()); Book book = Book.book(Component.text("oyeshops manual"), Component.text("oyeshops"), pages); diff --git a/src/main/java/party/cybsec/oyeshops/gui/SetupDialog.java b/src/main/java/party/cybsec/oyeshops/gui/SetupDialog.java index ddb1504..dae9d98 100644 --- a/src/main/java/party/cybsec/oyeshops/gui/SetupDialog.java +++ b/src/main/java/party/cybsec/oyeshops/gui/SetupDialog.java @@ -122,6 +122,9 @@ public class SetupDialog { System.currentTimeMillis()); // 4. finalize shop immediately + plugin.getLogger().info( + "DEBUG: SetupDialog creating shop at " + + signBlock.getLocation()); plugin.getServer().getScheduler() .runTask(plugin, () -> { plugin.getShopActivationListener() diff --git a/src/main/java/party/cybsec/oyeshops/listener/ShopActivationListener.java b/src/main/java/party/cybsec/oyeshops/listener/ShopActivationListener.java index f2c55c8..419776e 100644 --- a/src/main/java/party/cybsec/oyeshops/listener/ShopActivationListener.java +++ b/src/main/java/party/cybsec/oyeshops/listener/ShopActivationListener.java @@ -202,14 +202,20 @@ public class ShopActivationListener implements Listener { plugin.getShopRepository().deleteShopByLocation(signLocation); int shopId = plugin.getShopRepository().createShop(shop); + plugin.getLogger().info("DEBUG: created shop id " + shopId + " at " + signLocation); + plugin.getServer().getScheduler().runTask(plugin, () -> { // re-verify sign on main thread - if (!(signLocation.getBlock().getState() instanceof Sign finalSign)) + if (!(signLocation.getBlock().getState() instanceof Sign finalSign)) { + plugin.getLogger().info("DEBUG: sign missing at " + signLocation); return; + } Shop registeredShop = new Shop(shopId, signLocation, player.getUniqueId(), trade, 0, true, createdAt); plugin.getShopRegistry().register(registeredShop); + plugin.getLogger().info("DEBUG: registered shop " + shopId + " in registry"); + rewriteSignLines(finalSign, trade); player.sendMessage(Component.text("shop #" + shopId + " initialized!", NamedTextColor.GREEN)); });