diff --git a/DuneEss/build.gradle.kts b/DuneEss/build.gradle.kts index bc66af5e..d5913cdd 100644 --- a/DuneEss/build.gradle.kts +++ b/DuneEss/build.gradle.kts @@ -8,7 +8,9 @@ repositories { } dependencies { compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT") - compileOnly("com.github.MilkBowl:VaultAPI:1.7") + compileOnly("com.github.MilkBowl:VaultAPI:1.7") { + exclude(group = "org.bukkit", module = "bukkit") + } implementation("org.postgresql:postgresql:42.7.4") } tasks.jar { diff --git a/DuneEss/src/main/java/com/example/duneess/DuneEss.java b/DuneEss/src/main/java/com/example/duneess/DuneEss.java index 283ff73e..0bd7001a 100644 --- a/DuneEss/src/main/java/com/example/duneess/DuneEss.java +++ b/DuneEss/src/main/java/com/example/duneess/DuneEss.java @@ -1,6 +1,8 @@ package com.example.duneess; import net.milkbowl.vault.economy.Economy; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.command.*; @@ -35,6 +37,7 @@ public final class DuneEss extends JavaPlugin implements CommandExecutor, TabCom private String localPlanet; private NamespacedKey spiceKey; private NamespacedKey helpPageKey, helpActionKey; + private final Map helpPageByPlayer = new HashMap<>(); private static final String HELP_TITLE = ChatColor.DARK_RED + "Dune Field Guide"; private static final List> HELP_PAGES = List.of( List.of( @@ -137,9 +140,18 @@ public final class DuneEss extends JavaPlugin implements CommandExecutor, TabCom @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (args.length == 0 || args[0].equalsIgnoreCase("help")) { int page = 1; - if (args.length > 1) try { page = Integer.parseInt(args[1]); } catch (NumberFormatException ignored) { } - if (sender instanceof Player player) openHelpMenu(player, page); - else help(sender); + if (args.length > 1 && args[1].equalsIgnoreCase("menu")) { + if (sender instanceof Player player) openHelpMenu(player, 1); + else sender.sendMessage("The visual guide is available in-game: /duneess help menu"); + return true; + } + if (args.length > 1) { + if (args[1].equalsIgnoreCase("next")) page = (sender instanceof Player p ? helpPageByPlayer.getOrDefault(p.getUniqueId(), 1) : 1) + 1; + else if (args[1].equalsIgnoreCase("previous") || args[1].equalsIgnoreCase("prev")) page = (sender instanceof Player p ? helpPageByPlayer.getOrDefault(p.getUniqueId(), 1) : 1) - 1; + else try { page = Integer.parseInt(args[1]); } catch (NumberFormatException ignored) { } + } + if (sender instanceof Player player) sendHelpPage(player, page); + else help(sender, page); return true; } String root = args[0].toLowerCase(Locale.ROOT); @@ -160,9 +172,59 @@ public final class DuneEss extends JavaPlugin implements CommandExecutor, TabCom return true; } - private void help(CommandSender sender) { - sender.sendMessage(ChatColor.GOLD + "Dune Field Guide: use /duneess help [page] in-game to browse the command pages."); - sender.sendMessage(ChatColor.GRAY + "DuneEss provides Solaris and Guild travel. DuneCore provides factions, politics, and contracts."); + private void help(CommandSender sender, int page) { + int index = Math.max(0, Math.min(HELP_PAGES.size() - 1, page - 1)); + sender.sendMessage(ChatColor.DARK_RED + "╔" + "═".repeat(58) + "╗"); + sendBoxLine(sender, ChatColor.GOLD + "DUNE FIELD GUIDE" + ChatColor.DARK_GRAY + " • " + ChatColor.GRAY + "PAGE " + (index + 1) + " / " + HELP_PAGES.size()); + sender.sendMessage(ChatColor.DARK_RED + "╠" + "═".repeat(58) + "╣"); + for (HelpEntry entry : HELP_PAGES.get(index)) { + sendBoxLine(sender, ChatColor.YELLOW + entry.command()); + for (String descriptionLine : wrap(entry.description(), 50)) + sendBoxLine(sender, ChatColor.GRAY + " " + descriptionLine); + sendBoxLine(sender, " "); + } + sender.sendMessage(ChatColor.DARK_RED + "╠" + "═".repeat(58) + "╣"); + sendBoxLine(sender, ChatColor.GRAY + "Use /duneess help menu for the visual guide."); + sendBoxLine(sender, ChatColor.GRAY + "DuneEss: Solaris & Guild travel • DuneCore: factions & Arrakis"); + sender.sendMessage(ChatColor.DARK_RED + "╚" + "═".repeat(58) + "╝"); + if (sender instanceof Player player) { + helpPageByPlayer.put(player.getUniqueId(), index + 1); + TextComponent nav = new TextComponent("§8[ " + (index == 0 ? "§8◀ Previous" : "§e◀ Previous") + " §8] "); + if (index > 0) nav.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/duneess help previous")); + TextComponent next = new TextComponent("§8[ " + (index == HELP_PAGES.size() - 1 ? "§8Next ▶" : "§eNext ▶") + " §8]"); + if (index < HELP_PAGES.size() - 1) next.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/duneess help next")); + TextComponent pages = new TextComponent("§7 (page " + (index + 1) + "/" + HELP_PAGES.size() + ")"); + player.spigot().sendMessage(nav, next, pages); + } else { + sender.sendMessage(ChatColor.GRAY + "Page " + (index + 1) + "/" + HELP_PAGES.size() + " • /duneess help previous | next"); + } + } + + private void sendHelpPage(Player player, int page) { + int boundedPage = Math.max(1, Math.min(HELP_PAGES.size(), page)); + help(player, boundedPage); + } + + private void sendBoxLine(CommandSender sender, String text) { + String plain = ChatColor.stripColor(text); + if (plain.length() > 56) plain = plain.substring(0, 55) + "…"; + String padding = " ".repeat(Math.max(0, 56 - plain.length())); + sender.sendMessage(ChatColor.DARK_RED + "║ " + text + padding + " " + ChatColor.DARK_RED + "║"); + } + + private List wrap(String text, int width) { + List lines = new ArrayList<>(); + StringBuilder line = new StringBuilder(); + for (String word : text.split("\\s+")) { + if (line.length() > 0 && line.length() + 1 + word.length() > width) { + lines.add(line.toString()); + line.setLength(0); + } + if (line.length() > 0) line.append(' '); + line.append(word); + } + if (line.length() > 0) lines.add(line.toString()); + return lines; } private void openHelpMenu(Player player, int page) { @@ -456,7 +518,7 @@ public final class DuneEss extends JavaPlugin implements CommandExecutor, TabCom @Override public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { if(args.length==1)return complete(List.of("help","balance","sell","travel","admin"),args[0]); - if(args[0].equalsIgnoreCase("help")&&args.length==2)return complete(List.of("1","2","3","4"),args[1]); + if(args[0].equalsIgnoreCase("help")&&args.length==2)return complete(List.of("1","2","3","4","next","previous","menu"),args[1]); if(args[0].equalsIgnoreCase("travel")&&args.length==2)return complete(PLANETS,args[1]); if(args[0].equalsIgnoreCase("admin")&&sender.hasPermission("dune.admin")){ if(args.length==2)return complete(List.of("solari","teleport","spicebloom"),args[1]); diff --git a/DuneRealms-minecraft-only/README.md b/DuneRealms-minecraft-only/README.md index 9c96b165..2aa7a680 100644 --- a/DuneRealms-minecraft-only/README.md +++ b/DuneRealms-minecraft-only/README.md @@ -2,7 +2,7 @@ Requires Java 21 and Gradle 8+. Build each project folder separately. Install Vault, then `DuneEss`, `DuneCore`, and `DuneTerrain` into Paper's `plugins/` directory. DuneEss owns Solaris and Guild/admin travel and registers its economy through Vault; DuneCore provides factions, spice gameplay, politics, and jobs; DuneTerrain generates the planet worlds. Remove the old `DuneRealms.jar` when upgrading. -Commands: `/dune choose fremen|harkonnen|corrino|atreides|ordos`, `/dune kit`, `/dune guildnpc` (OP), `/dune givespice` (OP), `/duneess balance`, `/duneess sell`, `/duneess travel [planet]`, and `/duneess admin ...`. Use `/dune help` or `/duneess help` for the paginated in-game guide; tab completion suggests valid subcommands, factions, online players, and contract IDs. +Commands: `/dune choose fremen|harkonnen|corrino|atreides|ordos`, `/dune kit`, `/dune guildnpc` (OP), `/dune givespice` (OP), `/duneess balance`, `/duneess sell`, `/duneess travel [planet]`, and `/duneess admin ...`. Use `/dune help` or `/duneess help` for the spaced, boxed chat guide with clickable Previous/Next links. `/duneess help ` opens a page directly and `/duneess help menu` opens the inventory guide. For proxy travel, configure `network.local-planet` for this backend and the `network.servers` proxy names. The selected world is generated by DuneTerrain, with `server.planet` in `plugins/DuneTerrain/config.yml` set to the same planet. DuneTerrain applies terrain generation only when the world is first created; existing worlds and generated chunks are not replaced. On Arrakis, defaults place cave sietches and spice blows about every 2,000 blocks, and raised darkstone islands about every 750 blocks, with broad flat sand plateaus and steep exposed blackstone and basalt sides. Sietches include a stone-arched cave entrance, sleeping and kitchen chambers, a gently winding descent to a larger reservoir with a waterfall, and a personal cache with at least 250 tagged spice, enchanted gold armor, planks, and bread. Hitting a spice blow with an arrow or trident, or touching it with a living entity, releases a rich spice field worth about 15,000 Solaris. Oasis trees remain sparse at roughly 300-block spacing. Admins can use `/duneess admin teleport [player]` for Arrakis landmarks, `/duneess admin spicebloom [player]` to place an untriggered bloom about 50 blocks ahead, and `/duneess admin solari ` to grant Solaris. Hostile Haunted Fremen husks spawn on Arrakis, with an increased chance near fields worth more than 5,000 Solaris; configure them under `spice-raiders` in DuneCore's config. @@ -14,7 +14,7 @@ Admins with `dune.admin` can force teleport to Arrakis or generated landmarks wi ## Sandworms (Shai-Hulud) -Hostile oversized Sniffers representing sandworms spawn on sandy surfaces near players **only on Arrakis**, at most once per hour serverwide by default. The successful spawn time is saved in the plugin config, so a restart does not reset the cooldown. They have 500 health and 8 melee damage, and play a Warden roar when emerging. Their movement speed is 0.16: a little faster than walking, but players can outrun them by sprinting. Settings are under `sandworms` in `config.yml`. `DuneResourcePack.zip` adds a sandworm texture, haunted Fremen husk texture, and distinct spice-gold suspicious sand. Vanilla resource packs change textures, not Sniffer geometry. +Hostile oversized Sniffers representing sandworms spawn on sandy surfaces near players **only on Arrakis**, at most once per hour serverwide by default. The successful spawn time is saved in the plugin config, so a restart does not reset the cooldown. They have 500 health and 8 melee damage, and play a Warden roar when emerging. Their default movement attribute is 0.12 with a 1.0 pathfinding speed modifier, making them slightly faster than the Sniffer baseline while leaving sprinting as a way to escape. Settings are under `sandworms` in `config.yml`. `DuneResourcePack.zip` adds a sandworm texture, haunted Fremen husk texture, and distinct spice-gold suspicious sand. Vanilla resource packs change textures, not Sniffer geometry. ## Spice contracts and sandworm blooms - On Arrakis, defeating a sandworm generates a broad patch of suspicious-sand spice deposits with a target base harvest value of 100,000 Solaris (actual value depends on available sandy terrain and faction bonuses). diff --git a/DuneRealms-minecraft-only/build.gradle.kts b/DuneRealms-minecraft-only/build.gradle.kts index 4ff0ad79..f1ea332f 100644 --- a/DuneRealms-minecraft-only/build.gradle.kts +++ b/DuneRealms-minecraft-only/build.gradle.kts @@ -4,7 +4,9 @@ version = "1.0.3" repositories { mavenCentral(); maven("https://repo.papermc.io/repository/maven-public/"); maven("https://jitpack.io") } dependencies { compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT") - compileOnly("com.github.MilkBowl:VaultAPI:1.7") + compileOnly("com.github.MilkBowl:VaultAPI:1.7") { + exclude(group = "org.bukkit", module = "bukkit") + } implementation("org.postgresql:postgresql:42.7.4") } tasks.jar { diff --git a/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/DuneCore.java b/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/DuneCore.java index 9cc6d9b3..ef4c62ab 100644 --- a/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/DuneCore.java +++ b/DuneRealms-minecraft-only/src/main/java/com/example/dunerealms/DuneCore.java @@ -855,7 +855,7 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu h.getPersistentDataContainer().set(wormKey, PersistentDataType.BYTE, (byte)1); h.setCustomName(ChatColor.GOLD + "Shai-Hulud | Sandworm"); h.setCustomNameVisible(true); h.setRemoveWhenFarAway(true); h.setAware(true); h.getAttribute(Attribute.MAX_HEALTH).setBaseValue(getConfig().getDouble("sandworms.health", 500.0)); h.setHealth(h.getAttribute(Attribute.MAX_HEALTH).getValue()); - h.getAttribute(Attribute.MOVEMENT_SPEED).setBaseValue(getConfig().getDouble("sandworms.movement-speed", 0.16)); + h.getAttribute(Attribute.MOVEMENT_SPEED).setBaseValue(getConfig().getDouble("sandworms.movement-speed", 0.12)); h.getAttribute(Attribute.SCALE).setBaseValue(getConfig().getDouble("sandworms.scale", 2.8)); }); world.spawnParticle(Particle.CLOUD, location, 45, 2, 1, 2, 0.1); @@ -868,7 +868,7 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu } private void updateSandworms() { World world=Bukkit.getWorld("arrakis");if(world==null)return; - double speed=Math.max(0.55,Math.min(1.15,getConfig().getDouble("sandworms.path-speed",0.82))); + double speed=Math.max(0.55,Math.min(1.15,getConfig().getDouble("sandworms.path-speed",1.0))); double damage=Math.max(1.0,getConfig().getDouble("sandworms.attack-damage",8.0));long cooldown=Math.max(1000L,getConfig().getLong("sandworms.attack-cooldown-ms",2200L));long now=System.currentTimeMillis(); for(Sniffer worm:world.getEntitiesByClass(Sniffer.class)){if(!isWorm(worm)||worm.isDead())continue; Player target=world.getPlayers().stream().filter(Player::isOnline).min(Comparator.comparingDouble(p->p.getLocation().distanceSquared(worm.getLocation()))).orElse(null); diff --git a/DuneRealms-minecraft-only/src/main/resources/config.yml b/DuneRealms-minecraft-only/src/main/resources/config.yml index c81b5f49..6daf54fb 100644 --- a/DuneRealms-minecraft-only/src/main/resources/config.yml +++ b/DuneRealms-minecraft-only/src/main/resources/config.yml @@ -7,8 +7,8 @@ sandworms: health: 500.0 attack-damage: 8.0 attack-cooldown-ms: 2200 - movement-speed: 0.16 - path-speed: 0.82 + movement-speed: 0.12 + path-speed: 1.0 scale: 2.8 max-per-world: 3 spawn-chance: 0.35