diff --git a/DuneRealms-minecraft-only/README.md b/DuneRealms-minecraft-only/README.md index 9287b67f..939e71ac 100644 --- a/DuneRealms-minecraft-only/README.md +++ b/DuneRealms-minecraft-only/README.md @@ -2,7 +2,7 @@ Requires Java 21 and Gradle 8+. Run `gradle build` and copy `build/libs/DuneCore-1.0.3.jar` into your Paper server's `plugins/` directory. DuneCore provides factions, spice gameplay, politics, jobs, and Guild travel. Install the separate `DuneTerrain` plugin to generate the server's planet world. Remove the old `DuneRealms.jar` from the Paper `plugins/` folder when upgrading to `DuneCore.jar`. -Commands: `/dune choose fremen|harkonnen|corrino|atreides`, `/dune kit`, `/dune balance`, `/dune sell`, `/dune travel`, `/dune guildnpc` (OP), `/dune givespice` (OP). +Commands: `/dune choose fremen|harkonnen|corrino|atreides|ordos`, `/dune kit`, `/dune balance`, `/dune sell`, `/dune travel`, `/dune guildnpc` (OP), `/dune givespice` (OP). Use `/dune help` for a categorized command guide with descriptions; tab completion suggests valid subcommands, factions, online players, and contract IDs. 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 `/dune admin sietch [player]` and `/dune admin spiceblow [player]` to teleport to the nearest generated structure, `/dune admin spicebloom [player]` or `/dune admin spiceblow spawn [player]` to place an untriggered spice bloom about 50 blocks ahead, `/dune admin arrakis [player]` to reach the Arrakis spawn, and `/dune admin solari ` to grant Solaris to an online player. Hostile Spice Raider husks spawn randomly on Arrakis, with an increased chance near fields worth more than 5,000 Solaris; configure them under `spice-raiders` in DuneCore's config. 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 c2d66309..4a02f160 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 @@ -42,7 +42,7 @@ import java.util.*; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; -public final class DuneCore extends JavaPlugin implements Listener, CommandExecutor { +public final class DuneCore extends JavaPlugin implements Listener, CommandExecutor, TabCompleter { private final String[] planets = {"arrakis", "giedi_prime", "kaitain", "caladan", "sigma_draconis_iv"}; private final String[] factions = {"Fremen", "Harkonnen", "Corrino", "Atreides", "Ordos"}; private final Map selected = new HashMap<>(); @@ -96,7 +96,9 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu Bukkit.getScheduler().runTaskTimer(this, this::checkArrakisSun, 20L, 20L); Bukkit.getScheduler().runTaskTimer(this, this::applyFactionSetEffects, 20L, 20L); gui = new ConfigurableGui(this, serverJobs, money, jobs, planets, factions, selected); - Objects.requireNonNull(getCommand("dune")).setExecutor(this); + PluginCommand duneCommand = Objects.requireNonNull(getCommand("dune")); + duneCommand.setExecutor(this); + duneCommand.setTabCompleter(this); Bukkit.getPluginManager().registerEvents(this, this); Bukkit.getScheduler().runTaskTimer(this, this::spawnSandworms, 200L, 200L); Bukkit.getScheduler().runTaskTimer(this, this::spawnSpiceRaiders, 200L, 200L); @@ -475,6 +477,10 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu p.openInventory(inv); } @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { + if (args.length > 0 && args[0].equalsIgnoreCase("help")) { + sendHelp(sender); + return true; + } if (args.length > 0 && args[0].equalsIgnoreCase("admin")) { if (!sender.hasPermission("dune.admin")) { sender.sendMessage(ChatColor.RED + "Admin only."); return true; } if (args.length < 2 || (!args[1].equalsIgnoreCase("arrakis") && !args[1].equalsIgnoreCase("sietch") @@ -528,9 +534,6 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu } if (!(sender instanceof Player p)) { sender.sendMessage("Run this command in-game."); return true; } if (args.length == 0) { gui.open(p, "main"); return true; } - if (args[0].equalsIgnoreCase("help")) { - p.sendMessage(ChatColor.GOLD + "/dune choose , kit, balance, sell, water, travel, politics, exchange, serverjobs, serverjobs accept , job post , job accept , job finish, admin arrakis|sietch|spiceblow [player], admin spicebloom [player], admin spiceblow spawn [player], admin solari "); return true; - } switch (args[0].toLowerCase(Locale.ROOT)) { case "choose" -> { if (args.length < 2) { p.sendMessage("Choose a faction name."); break; } @@ -573,6 +576,127 @@ public final class DuneCore extends JavaPlugin implements Listener, CommandExecu return true; } + private void sendHelp(CommandSender sender) { + sender.sendMessage(ChatColor.GOLD + "=== DuneCore command guide ==="); + helpSection(sender, "General"); + helpLine(sender, "/dune", "Open the Dune Navigator menu."); + helpLine(sender, "/dune help", "Show this command guide."); + helpLine(sender, "/dune choose ", "Join Fremen, Harkonnen, Corrino, Atreides, or Ordos and receive its kit."); + helpLine(sender, "/dune kit", "Receive your selected faction's kit."); + helpLine(sender, "/dune elytra", "Merge or repair elytra equipment in your inventory."); + helpLine(sender, "/dune menu | /dune gui", "Open the Dune Navigator menu."); + helpLine(sender, "/dune menuitem", "Give yourself a portable Dune Navigator item."); + + helpSection(sender, "Travel"); + helpLine(sender, "/dune travel", "Open the Spacing Guild planet travel menu."); + + helpSection(sender, "Solaris and spice"); + helpLine(sender, "/dune balance", "Check your Solaris balance."); + helpLine(sender, "/dune sell", "Sell tagged spice from your inventory for Solaris."); + helpLine(sender, "/dune exchange", "Open the player-posted spice job exchange."); + + helpSection(sender, "Politics"); + helpLine(sender, "/dune politics status", "Show Trust funds, election leaders, imperial appointments, and any invasion."); + helpLine(sender, "/dune politics deposit ", "Contribute your Solaris to the Spacing Trust."); + helpLine(sender, "/dune politics vote ", "Vote for a leader of your faction."); + helpLine(sender, "/dune politics emperorvote ", "Vote for the Emperor."); + helpLine(sender, "/dune politics leader", "Show the elected leader of your faction."); + helpLine(sender, "/dune politics invasion ", "Let your elected faction leader start an invasion, if the Trust can fund it."); + helpLine(sender, "/dune politics defend", "Contribute to your faction's defense against an active invasion."); + helpLine(sender, "/dune politics steward ", "Let the Emperor appoint the house that controls spice rights."); + helpLine(sender, "/dune politics houseofwater ", "Let the Emperor appoint the house that controls water rights."); + helpLine(sender, "/dune trust ", "Alias for /dune politics."); + + helpSection(sender, "Contracts and water"); + helpLine(sender, "/dune serverjobs [accept ]", "View hourly CHOAM spice contracts or accept an available contract."); + helpLine(sender, "/dune job", "View player-posted spice exchange jobs."); + helpLine(sender, "/dune job post ", "List a spice gathering job for another player."); + helpLine(sender, "/dune job accept ", "Accept another player's spice gathering job."); + helpLine(sender, "/dune job finish", "Leave your active player-posted job."); + helpLine(sender, "/dune job cancel", "Cancel your unclaimed job listing."); + helpLine(sender, "/dune water guild", "Register as a Guild water trader for the standard legal rate."); + helpLine(sender, "/dune water smuggler", "Choose the higher-paying but riskier water smuggling career."); + helpLine(sender, "/dune water sell", "Sell finite water buckets collected on Arrakis."); + helpLine(sender, "/dune water status", "Show your water career and how water trading works."); + + if (sender.hasPermission("dune.admin")) { + helpSection(sender, "Admin (dune.admin)"); + helpLine(sender, "/dune guireload", "Reload the configurable Navigator menu."); + helpLine(sender, "/dune guildnpc", "Spawn a Spacing Guild Navigator at your location."); + helpLine(sender, "/dune givespice", "Give yourself one spice item."); + helpLine(sender, "/dune admin arrakis [player]", "Teleport a player to the loaded Arrakis spawn."); + helpLine(sender, "/dune admin sietch [player]", "Teleport a player to a generated Arrakis sietch."); + helpLine(sender, "/dune admin spiceblow [player]", "Teleport a player to the nearest generated spice blow."); + helpLine(sender, "/dune admin spicebloom [player]", "Place an untriggered spice bloom about 50 blocks ahead of a player on Arrakis."); + helpLine(sender, "/dune admin spiceblow spawn [player]", "Alias for placing a spice bloom about 50 blocks ahead."); + helpLine(sender, "/dune admin solari ", "Add Solaris to an online player's balance."); + } + } + + private void helpLine(CommandSender sender, String command, String description) { + sender.sendMessage(ChatColor.YELLOW + command + ChatColor.GRAY + " — " + description); + } + + private void helpSection(CommandSender sender, String section) { + sender.sendMessage(ChatColor.AQUA + "--- " + section + " ---"); + } + + @Override public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { + if (args.length == 0) return List.of(); + String root = args[0].toLowerCase(Locale.ROOT); + if (args.length == 1) { + List commands = new ArrayList<>(List.of("help", "choose", "elytra", "kit", "politics", "trust", "water", + "balance", "sell", "travel", "menu", "gui", "menuitem", "exchange", "serverjobs", "job")); + if (sender.hasPermission("dune.admin")) commands.addAll(List.of("admin", "guireload", "guildnpc", "givespice")); + return matching(commands, args[0]); + } + + if (root.equals("choose") && args.length == 2) return matching(Arrays.asList(factions), args[1]); + if ((root.equals("politics") || root.equals("trust")) && args.length == 2) + return matching(List.of("status", "deposit", "vote", "emperorvote", "leader", "invasion", "defend", "steward", "houseofwater"), args[1]); + if ((root.equals("politics") || root.equals("trust")) && args.length == 3) { + if (args[1].equalsIgnoreCase("vote") || args[1].equalsIgnoreCase("emperorvote")) return onlinePlayerNames(args[2]); + if (args[1].equalsIgnoreCase("invasion") || args[1].equalsIgnoreCase("steward") || args[1].equalsIgnoreCase("houseofwater")) + return matching(Arrays.asList(factions), args[2]); + } + if (root.equals("water") && args.length == 2) return matching(List.of("guild", "smuggler", "sell", "status"), args[1]); + if (root.equals("serverjobs") && args.length == 2) { + List options = new ArrayList<>(List.of("accept")); + if (sender.hasPermission("dune.admin")) options.add("reload"); + return matching(options, args[1]); + } + if (root.equals("serverjobs") && args.length == 3 && args[1].equalsIgnoreCase("accept")) + return matching(serverJobs.offerIds(), args[2]); + if (root.equals("job") && args.length == 2) return matching(List.of("post", "accept", "finish", "cancel"), args[1]); + if (root.equals("job") && args.length == 3 && args[1].equalsIgnoreCase("accept")) return onlinePlayerNames(args[2]); + + if (root.equals("admin") && sender.hasPermission("dune.admin")) { + if (args.length == 2) return matching(List.of("arrakis", "sietch", "spiceblow", "spicebloom", "solari"), args[1]); + String action = args[1].toLowerCase(Locale.ROOT); + if (action.equals("solari") && args.length == 3) return onlinePlayerNames(args[2]); + if (action.equals("solari") && args.length == 4) return matching(List.of("100", "500", "1000", "5000"), args[3]); + if (action.equals("spiceblow") && args.length == 3) { + List options = new ArrayList<>(onlinePlayerNames(args[2])); + if ("spawn".startsWith(args[2].toLowerCase(Locale.ROOT))) options.add("spawn"); + return options; + } + if (action.equals("spiceblow") && args.length == 4 && args[2].equalsIgnoreCase("spawn")) return onlinePlayerNames(args[3]); + if ((action.equals("arrakis") || action.equals("sietch") || action.equals("spicebloom")) && args.length == 3) + return onlinePlayerNames(args[2]); + } + return List.of(); + } + + private List onlinePlayerNames(String prefix) { + return matching(Bukkit.getOnlinePlayers().stream().map(Player::getName).toList(), prefix); + } + + private List matching(Collection options, String prefix) { + String start = prefix.toLowerCase(Locale.ROOT); + return options.stream().filter(option -> option.toLowerCase(Locale.ROOT).startsWith(start)) + .distinct().sorted(String.CASE_INSENSITIVE_ORDER).toList(); + } + private void teleportToNearestSietch(CommandSender sender, Player target, World arrakis) { Location origin = target.getWorld().equals(arrakis) ? target.getLocation() : arrakis.getSpawnLocation(); int spacing = 2000; diff --git a/DuneTerrain/src/main/java/com/example/duneterrain/DuneTerrain.java b/DuneTerrain/src/main/java/com/example/duneterrain/DuneTerrain.java index 0e96d8be..7c93bf49 100644 --- a/DuneTerrain/src/main/java/com/example/duneterrain/DuneTerrain.java +++ b/DuneTerrain/src/main/java/com/example/duneterrain/DuneTerrain.java @@ -595,28 +595,37 @@ public final class DuneTerrain extends JavaPlugin implements Listener { int y = region.getHighestBlockYAt(x, z); if (y < world.getMinHeight() + 40 || y > world.getMaxHeight() - 4 || y - 36 < world.getMinHeight()) return; - // Hub with three side chambers and a lower reservoir, all within the populator's chunk buffer. + // Enlarged hub, side chambers, cache chamber, and reservoir. The surface entrance stays compact. int hy = y - 11; - carveRoom(region, x, hy, z, 5, 3, 5); - carveTunnel(region, x, hy - 2, z - 3, x - 7, hy - 6, z - 2); - carveRoom(region, x - 9, hy - 6, z - 2, 4, 2, 4); - carveTunnel(region, x, hy - 2, z + 3, x + 7, hy - 6, z + 2); - carveRoom(region, x + 9, hy - 6, z + 2, 4, 2, 4); - carveTunnel(region, x, hy - 2, z - 3, x, hy - 10, z - 9); - carveRoom(region, x, hy - 12, z - 10, 4, 2, 4); - carveTunnel(region, x, hy - 3, z + 3, x, hy - 18, z + 7); - carveRoom(region, x, hy - 23, z + 8, 7, 5, 7); + carveRoom(region, x, hy, z, 10, 6, 10); + carveTunnelNetwork(region, new int[][]{ + {x - 8, hy - 3, z - 2}, {x - 12, hy - 4, z - 2}, {x - 16, hy - 5, z - 2} + }); + carveRoom(region, x - 18, hy - 6, z - 2, 8, 4, 8); + carveTunnelNetwork(region, new int[][]{ + {x + 8, hy - 3, z + 2}, {x + 12, hy - 4, z + 2}, {x + 16, hy - 5, z + 2} + }); + carveRoom(region, x + 18, hy - 6, z + 2, 8, 4, 8); + carveTunnelNetwork(region, new int[][]{ + {x, hy - 3, z - 3}, {x - 3, hy - 4, z - 5}, {x - 6, hy - 5, z - 8}, + {x - 4, hy - 6, z - 11}, {x, hy - 7, z - 12}, {x + 3, hy - 8, z - 11}, + {x, hy - 10, z - 10} + }); + carveRoom(region, x, hy - 12, z - 10, 8, 4, 8); + carveRoom(region, x, hy - 23, z + 8, 14, 10, 14); // A broad, rough cave mouth opens from the surface and slopes down into the hub. carveCaveEntrance(region, x, z, hy); - // A winding, gently descending cave ramp leads from the hub to the enlarged reservoir. - carveTunnel(region, x, hy - 3, z + 3, x - 4, hy - 5, z + 5); - carveTunnel(region, x - 4, hy - 5, z + 5, x - 7, hy - 8, z + 8); - carveTunnel(region, x - 7, hy - 8, z + 8, x - 7, hy - 11, z + 11); - carveTunnel(region, x - 7, hy - 11, z + 11, x - 4, hy - 14, z + 13); - carveTunnel(region, x - 4, hy - 14, z + 13, x, hy - 17, z + 11); - carveTunnel(region, x, hy - 17, z + 11, x, hy - 20, z + 8); + // Long switchbacks keep the descent gradual from the hub to the enlarged reservoir. + carveTunnelNetwork(region, new int[][]{ + {x, hy - 3, z + 3}, {x - 4, hy - 4, z + 5}, {x - 8, hy - 5, z + 8}, + {x - 10, hy - 6, z + 12}, {x - 8, hy - 7, z + 14}, {x - 4, hy - 8, z + 14}, + {x - 2, hy - 9, z + 12}, {x - 5, hy - 10, z + 9}, {x - 8, hy - 11, z + 7}, + {x - 10, hy - 12, z + 9}, {x - 8, hy - 13, z + 12}, {x - 5, hy - 14, z + 13}, + {x - 3, hy - 15, z + 10}, {x - 5, hy - 16, z + 7}, {x - 7, hy - 17, z + 8}, + {x - 5, hy - 18, z + 10}, {x - 4, hy - 19, z + 9}, {x - 5, hy - 20, z + 8} + }); // The waterfall runs beside the ramp and feeds a broad pool at the bottom. for (int dy = -4; dy >= -25; dy--) { @@ -633,10 +642,10 @@ public final class DuneTerrain extends JavaPlugin implements Listener { set(region, x + dx, waterY, z + 8 + dz, Material.WATER); } - furnishSleepingHall(region, x - 9, hy - 6, z - 2); - furnishKitchen(region, x + 9, hy - 6, z + 2); + furnishSleepingHall(region, x - 18, hy - 6, z - 2); + furnishKitchen(region, x + 18, hy - 6, z + 2); placePersonalChest(region, x, hy - 14, z - 10, cellX, cellZ); - for (int[] lamp : new int[][]{{0,-1,0},{-11,-5,-2},{11,-5,2},{0,-11,-11}}) + for (int[] lamp : new int[][]{{0,-1,0},{-20,-5,-2},{20,-5,2},{0,-11,-11}}) set(region, x + lamp[0], hy + lamp[1], z + lamp[2], Material.TORCH); } @@ -669,7 +678,11 @@ public final class DuneTerrain extends JavaPlugin implements Listener { // Hollow a rough chamber just behind the stone arch, then connect it to the hub. carveRoom(region, entryX, mouthY, entryZ, 3, 2, 3); carveCaveTunnel(region, outsideX, surfaceY - 1, entryZ, x + 6, mouthY, entryZ); - carveTunnel(region, x + 6, mouthY, entryZ, x, hubY + 1, z); + carveTunnelNetwork(region, new int[][]{ + {x + 6, mouthY, entryZ}, {x + 3, mouthY - 1, z - 9}, {x, mouthY - 2, z - 11}, + {x - 4, mouthY - 3, z - 10}, {x - 6, mouthY - 4, z - 7}, + {x - 5, mouthY - 5, z - 3}, {x - 2, mouthY - 6, z - 1}, {x, hubY + 1, z} + }); // Irregular stone and tuff form a visible cave arch around the entrance. int faceX = x + 7; @@ -701,6 +714,13 @@ public final class DuneTerrain extends JavaPlugin implements Listener { } } + private static void carveTunnelNetwork(LimitedRegion region, int[][] points) { + for (int i = 1; i < points.length; i++) { + int[] from = points[i - 1], to = points[i]; + carveTunnel(region, from[0], from[1], from[2], to[0], to[1], to[2]); + } + } + private static void carveCaveTunnel(LimitedRegion region, double ax, double ay, double az, double bx, double by, double bz) { int steps = (int)Math.ceil(Math.sqrt((bx-ax)*(bx-ax) + (by-ay)*(by-ay) + (bz-az)*(bz-az)) * 1.5); for (int i = 0; i <= steps; i++) {