diff --git a/.github/workflows/lobby.yml b/.github/workflows/lobby.yml new file mode 100644 index 00000000..584d96d4 --- /dev/null +++ b/.github/workflows/lobby.yml @@ -0,0 +1,28 @@ +name: Build Guild Lobby companion +on: + workflow_dispatch: + push: + branches: [main, beta] + paths: ['DuneLobby/**', 'worlds/**', '.github/workflows/lobby.yml'] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + - uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: '8.14' + - run: gradle -p DuneLobby build + - uses: actions/upload-artifact@v4 + with: + name: Dune-Guild-Lobby + path: | + DuneLobby/build/libs/*.jar + worlds/Dune-Guild-Lobby-1.0.0.zip + DuneLobby/README.md + DuneLobby/VALIDATION.md + if-no-files-found: error diff --git a/DuneLobby/README.md b/DuneLobby/README.md new file mode 100644 index 00000000..4f4a2b38 --- /dev/null +++ b/DuneLobby/README.md @@ -0,0 +1,77 @@ +# Spacing Guild lobby world + +A separate **Minecraft Java / Paper 1.21.4 / Java 21** End-dimension lobby. The world is already built and saved in [`../worlds/Dune-Guild-Lobby-1.0.0.zip`](../worlds/Dune-Guild-Lobby-1.0.0.zip); the deterministic builder and runtime companion are here. It does not replace a planet world. + +![Design concept](previews/guild-lobby-concept.png) + +The image above is AI concept art generated with the built-in image tool, not an in-game screenshot. Actual architecture uses vanilla block geometry; the End sky is vanilla, not a shader or a custom purple sky. Ordinary vanilla light is not coloured. The saved world contains enclosed roofs; the concept removes them to show the rooms. [`previews/saved-world-plan.png`](previews/saved-world-plan.png) is generated from the actual saved blocks. + +## Rooms + +| Room | Centre X/Z | Contents | +|---|---|---| +| Central spawn | 0 / 0 | Safe arrival at **0.5, 81, 10.5**, facing north; block-built aquatic Navigator inside an amber glass tank, Guild liaison | +| Starport / teleport | -78 / -58 | Dune II inspired square arrival apron, grounded frigate, control tower and **five raised launch pads** with striped edges, lights and destination consoles | +| Official Exchange | -66 / 40 | CHOAM counters, commodities, storage and Exchange Broker | +| News | 62 / -42 | Illustrated dispatch panel, reading benches and interactive news lecterns | +| Rules | 62 / 37 | Charter panel, benches and interactive rules lecterns | +| Smuggler exchange | -66 / 101 | Dim side passage, screens, brown awnings, crates, worn copper; separate **water** and **spice** seller NPCs | + +All rooms connect by enclosed corridors. Launch consoles ask for confirmation. There are no Nether portals: the starport is a landing/launch design. + +## Install the already built world + +1. Use a **separate lobby Paper backend**. Stop that server before copying files. Leave existing planet servers and worlds in place. +2. Extract the ZIP into the server directory. It contains `guild_lobby/`, `plugins/DuneLobby-1.0.0.jar`, and these setup instructions. Do not extract over an existing `guild_lobby`; preserve it separately first. +3. Install [ImageFrame from Spigot](https://www.spigotmc.org/resources/106031/). The tested version is **2026.1.5.0**, which lists Minecraft 1.21.4 support. With Python available, `python DuneLobby/tools/install_imageframe.py /path/to/lobby-server` downloads that exact dependency and verifies its SHA256. The third-party JAR is not vendored in this repository/package. Dependency source: (GPL-3.0). +4. Start Paper. DuneLobby loads `guild_lobby` as **THE_END**, preserves the saved blocks and restores the eleven ImageFrame panels. Artwork is included in DuneLobby's JAR, so no remote artwork hosting is required. ImageFrame map IDs are allocated for this server rather than trusting IDs from another world. Keep ImageFrame installed to render the pictures. +5. `/lobby` returns to central spawn. Console `dunelobby verify` checks spawn clearance, room/pad/vendor accessibility, NPCs and artwork. Console `dunelobby artwork` restores decorations if required; it reuses registered image maps instead of creating duplicates. + +DuneLobby creates a world only when **console** runs `dunelobby build`, and refuses if a folder with that name already exists. This command is for reproducing a new world, not installing the included map. No planet file or existing lobby structure is regenerated on startup. + +Keep Paper's default primary world as a small bootstrap world; the plugin loads the End lobby as a secondary world and routes joins/respawns there. Do not use `guild_lobby` as `level-name`, since that loads it as the primary overworld before the plugin can select THE_END. Example **lobby backend** settings: + +```properties +level-name=lobby_bootstrap +level-type=minecraft:flat +generator-settings={"layers":[],"biome":"minecraft:the_void","structures":{}} +generate-structures=false +allow-nether=false +spawn-protection=0 +``` + +For an existing multiworld server instead of a dedicated backend, set `join-at-lobby: false` and `respawn-at-lobby: false` in `plugins/DuneLobby/config.yml` to preserve other plugins' routing. The shipped ZIP is a **Paper multiworld import**, not a standalone singleplayer save or a schematic. DuneLobby supplies the void generator and prevents new End terrain around the build. + +## Network and economy + +- Optional DuneEss: launch consoles call the player's existing `/duneess travel `, preserving configured fares, permissions and Arrakis checks. The Navigator liaison opens `/duneess travel`. +- Without DuneEss: consoles teleport to an already loaded planet world, or request a Velocity/Bungee `Connect` using the names in the lobby config. Requests have no delivery acknowledgment and charge no fare. Configure and test the destinations on your own network; no live server deployment is performed by this package. +- The Exchange Broker opens `/dune exchange` when DuneCore is installed. Without DuneCore it explains that the official market needs that integration; no fake Solaris balances are created. +- Both smuggler sellers work without DuneCore/Vault: one drinking water potion for 4 emeralds, one orange-dye spice sample for 8 emeralds (configurable). **These are lobby barter goods**, deliberately not tagged finite Arrakis water or redeemable DuneCore spice. This avoids minting Solaris or faction rewards outside the existing economy. They are stationary, named, invulnerable villagers with custom merchant menus. +- News and rules lecterns display the text in the companion config. Run `dunelobby reload` after edits. Illustrated noticeboards are static artwork, not a live website feed. + +Velocity example (adapt the backend address): + +```toml +[servers] +lobby = "127.0.0.1:25570" +# Keep existing planet entries. +try = ["lobby"] + +[advanced] +bungee-plugin-message-channel = true +``` + +Use your existing modern forwarding configuration and forwarding secret. Do not install DuneTerrain on a dedicated lobby backend, since it is intended to create a selected planet. DuneCore/DuneEss remain optional and their shared economy/database setup is unchanged. + +## Protection and build + +Visitors cannot break/place blocks, manipulate frames, use ordinary container blocks or damage entities in the lobby. Explosions do not damage blocks, hostile spawns are suppressed, and falling below the build returns the player to spawn. Operators have `dunelobby.build` for maintenance; other worlds are unaffected. This companion does not implement a general-purpose region protection system for other plugins' console edits. + +Build the companion with `gradle -p DuneLobby build` using Java 21 and Gradle 8.14+. Typographic boards are reproducible with `python DuneLobby/tools/prepare_boards.py` (Pillow). Existing project artwork is copied unchanged from `docs/artwork`. The build embeds the local artwork; it downloads no artwork. + +Design references: [1984 Navigator / heighliner production artwork](https://www.duneinfo.com/arrakis/navigators/), [Dune II Starport](https://dunerts.wiki.gg/wiki/Starport_(Dune_II)). Reference designs are interpreted in blocks; the original game sprites and film stills are not included as new assets. + +## Validation + +See `VALIDATION.md` for the recorded build, actual saved-world checks and limitations. The package includes `manifest.json` with file hashes. No live network, paid Solaris transfer or real player account is used in local validation. diff --git a/DuneLobby/VALIDATION.md b/DuneLobby/VALIDATION.md new file mode 100644 index 00000000..a6fb5a3d --- /dev/null +++ b/DuneLobby/VALIDATION.md @@ -0,0 +1,31 @@ +# Guild lobby delivery validation — 2026-10-18 + +## Delivered + +- Saved End world: `worlds/Dune-Guild-Lobby-1.0.0.zip`, **10,893,624 bytes**, SHA256 `6ecfef68a94a603d1f0a7a0485c3bcfd40eeb2180205347e2a2a7eb0f143dda8`. +- ZIP contains the actual `guild_lobby/level.dat`, End Anvil region/entity/data files, DuneLobby 1.0.0 companion JAR, verified dependency installer, setup instructions and per-file SHA256 manifest. It contains no server executable, player data, session lock or world UUID file. +- Source, original panels and reused project artwork are in `DuneLobby/`. Source builds embed the artwork and do not fetch remote images. +- AI design preview and an independent plan rendered from the saved chunks are in `DuneLobby/previews/`. + +## Checks completed + +1. Compiled with Java 21.0.12.1 and Gradle 8.14 against Paper API 1.21.4. Build passed. This module has no separate unit-test suite; validation below runs the actual server/world. +2. Started a local, loopback-only **Paper 1.21.4 build 232** server with pinned **ImageFrame 2026.1.5.0**. Generated all six rooms, block Navigator, starport arrival apron, five launch platforms, frigate, corridors and four NPCs. Installed eleven ImageFrame panels (276 map tiles). +3. Runtime flood-fill checks passed: **16,274 reachable standing cells**, clear supported central spawn, routes to every room, both smuggler counters and all five raised launch pads. World environment reported **THE_END**. +4. Stopped and restarted the server. The imported world was reused, NPCs remained and artwork restored. Runtime verification passed after restart, without duplicate frames or merchants. +5. `dunelobby build` refused an existing world folder, as intended. +6. Extracted the package into a **second fresh Paper server** with no ImageFrame data or primary-world map data. It imported the End world, recreated its own image-map registry and restored all eleven panels. Runtime verification passed there too. A subsequent restart checked the final panel-facing adjustment and passed again. +7. Independently decoded the saved Anvil/NBT data after shutdown: Minecraft data version **4189**; spawn **0,81,10**; clear headroom; **109,535 non-air blocks in build height**; six supported room centres; five marked launch pads; exactly **4 villagers** (one each liaison, official broker, water seller, spice seller); exactly **276 glowing item frames**; **no Ender Dragon**. See `previews/saved-world-plan.json`. +8. ZIP integrity check passed. All included file hashes are recorded in its `manifest.json`. Temporary validation servers were shut down after testing. + +Final runtime output: + +```text +GUILD_VERIFY PASS walkable=16274 artwork=276 [] +``` + +## Practical limits + +The preview is concept art. The map uses real vanilla blocks, End atmosphere and ordinary vanilla light. There was no graphical Minecraft client available for an in-game visual walkthrough; the saved-block plan was visually inspected. Paid Solaris transactions, actual player merchant clicks and remote proxy destinations were not exercised. DuneEss/DuneCore integration routes through their existing player commands; configure those optional plugins before using the official economy. Lobby merchants use emerald barter and their spice/water are separate sample goods, not faction reward currency. No live server was deployed. + +The dedicated lobby has its own join/respawn routing. On an existing mixed backend, disable that routing in the companion config. Install ImageFrame separately using the pinned installer or its official distribution. Keep its data and primary-world map data with normal server backups after installation. diff --git a/DuneLobby/artwork/exchange.png b/DuneLobby/artwork/exchange.png new file mode 100644 index 00000000..c92d16ea Binary files /dev/null and b/DuneLobby/artwork/exchange.png differ diff --git a/DuneLobby/artwork/guild-navigator.png b/DuneLobby/artwork/guild-navigator.png new file mode 100644 index 00000000..ffea0c0f Binary files /dev/null and b/DuneLobby/artwork/guild-navigator.png differ diff --git a/DuneLobby/artwork/news.png b/DuneLobby/artwork/news.png new file mode 100644 index 00000000..64e38914 Binary files /dev/null and b/DuneLobby/artwork/news.png differ diff --git a/DuneLobby/artwork/rules.png b/DuneLobby/artwork/rules.png new file mode 100644 index 00000000..e54da647 Binary files /dev/null and b/DuneLobby/artwork/rules.png differ diff --git a/DuneLobby/artwork/smuggler-water-camp.png b/DuneLobby/artwork/smuggler-water-camp.png new file mode 100644 index 00000000..07236060 Binary files /dev/null and b/DuneLobby/artwork/smuggler-water-camp.png differ diff --git a/DuneLobby/artwork/spice-expedition.png b/DuneLobby/artwork/spice-expedition.png new file mode 100644 index 00000000..b9b50e68 Binary files /dev/null and b/DuneLobby/artwork/spice-expedition.png differ diff --git a/DuneLobby/artwork/world-0.png b/DuneLobby/artwork/world-0.png new file mode 100644 index 00000000..8bcb66b3 Binary files /dev/null and b/DuneLobby/artwork/world-0.png differ diff --git a/DuneLobby/artwork/world-1.png b/DuneLobby/artwork/world-1.png new file mode 100644 index 00000000..adf80037 Binary files /dev/null and b/DuneLobby/artwork/world-1.png differ diff --git a/DuneLobby/artwork/world-2.png b/DuneLobby/artwork/world-2.png new file mode 100644 index 00000000..031610ea Binary files /dev/null and b/DuneLobby/artwork/world-2.png differ diff --git a/DuneLobby/artwork/world-3.png b/DuneLobby/artwork/world-3.png new file mode 100644 index 00000000..ec6e5cf6 Binary files /dev/null and b/DuneLobby/artwork/world-3.png differ diff --git a/DuneLobby/artwork/world-4.png b/DuneLobby/artwork/world-4.png new file mode 100644 index 00000000..7ba50f52 Binary files /dev/null and b/DuneLobby/artwork/world-4.png differ diff --git a/DuneLobby/build.gradle.kts b/DuneLobby/build.gradle.kts new file mode 100644 index 00000000..0f0655a9 --- /dev/null +++ b/DuneLobby/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { java } +group = "com.example" +version = "1.0.0" +repositories { mavenCentral(); maven("https://repo.papermc.io/repository/maven-public/") } +dependencies { compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT") } +java { toolchain.languageVersion.set(JavaLanguageVersion.of(21)) } +tasks.withType { options.encoding = "UTF-8" } +tasks.processResources { from("artwork") { into("artwork") } } diff --git a/DuneLobby/previews/README.md b/DuneLobby/previews/README.md new file mode 100644 index 00000000..66c215d6 --- /dev/null +++ b/DuneLobby/previews/README.md @@ -0,0 +1,8 @@ +# Lobby previews + +- `guild-lobby-concept.png`: built-in ImageGen concept rendering, generated 2026-10-18. This is a visual design reference, not a Minecraft screenshot. +- `saved-world-plan.png` and `.json`: rendered and inspected from the actual saved Anvil world by `tools/inspect_world.py`; no image-generation model is used for the plan. + +Final ImageGen prompt (reference image was the preceding five-room starport concept): + +> Update this Minecraft Dune Spacing Guild lobby rendering with a SIXTH room, a shady SMUGGLER EXCHANGE. Preserve every existing room: central spawn with amber Guild Navigator tank, Dune II-inspired STARPORT / TELEPORT upper left with square landing and launch pads and block-built frigate, official EXCHANGE left, NEWS upper right, RULES right, purple End atmosphere and gold/blackstone architecture. Widen framing or pull back as needed to show all six distinct connected rooms clearly. Add the new smugglers' den as a substantial enclosed annex in the lower foreground below the official Exchange, attached via a narrow dim side corridor branching off the official Exchange. It must be visibly different: lower vaulted ceiling (removed for cutaway), dark worn stone, rusty copper pipes, patchwork brown cloth awnings/screens, stacked barrels and crates, low amber lanterns, discreet violet accents. TWO separate Minecraft villager seller NPCs behind separate screened market counters: WATER SELLER next to blue glass water vessels and a cauldron, SPICE SELLER beside orange spice samples and sacks represented by brown blocks and barrels. Small clear labels over counters 'WATER' and 'SPICE'. Shady illicit back-room atmosphere but navigable and readable. Clearly label the new annex 'SMUGGLER EXCHANGE' with matching clean external architectural callout. Keep five other callouts correctly pointing to their rooms. Floor of annex is fully supported and bounded, no unsafe holes; visible corridor connection. High-quality architectural Minecraft shader concept overview, block-built geometry and pixel textures, no photoreal smooth creatures. Retain wall artwork in framed maps. One wide coherent elevated isometric roofless cutaway, clean presentation, no HUD or watermark. diff --git a/DuneLobby/previews/guild-lobby-concept.png b/DuneLobby/previews/guild-lobby-concept.png new file mode 100644 index 00000000..f280684b Binary files /dev/null and b/DuneLobby/previews/guild-lobby-concept.png differ diff --git a/DuneLobby/previews/saved-world-plan.json b/DuneLobby/previews/saved-world-plan.json new file mode 100644 index 00000000..b97981fa --- /dev/null +++ b/DuneLobby/previews/saved-world-plan.json @@ -0,0 +1,21 @@ +{ + "minecraft": "1.21.4", + "data_version": 4189, + "spawn": [ + 0, + 81, + 10 + ], + "saved_non_air_blocks_in_build_height": 109535, + "entities": { + "minecraft:glow_item_frame": 276, + "minecraft:villager": 4 + }, + "npc_roles": { + "exchange": 1, + "water": 1, + "spice": 1, + "liaison": 1 + }, + "checks": "PASS: saved spawn, five launch pads, six rooms, four unique NPCs, 276 artwork frames, no dragon" +} diff --git a/DuneLobby/previews/saved-world-plan.png b/DuneLobby/previews/saved-world-plan.png new file mode 100644 index 00000000..99d9f542 Binary files /dev/null and b/DuneLobby/previews/saved-world-plan.png differ diff --git a/DuneLobby/settings.gradle.kts b/DuneLobby/settings.gradle.kts new file mode 100644 index 00000000..be5a57e8 --- /dev/null +++ b/DuneLobby/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "DuneLobby" diff --git a/DuneLobby/src/main/java/com/example/dunelobby/DuneLobby.java b/DuneLobby/src/main/java/com/example/dunelobby/DuneLobby.java new file mode 100644 index 00000000..d97d28a6 --- /dev/null +++ b/DuneLobby/src/main/java/com/example/dunelobby/DuneLobby.java @@ -0,0 +1,217 @@ +package com.example.dunelobby; + +import org.bukkit.*; +import org.bukkit.block.BlockFace; +import org.bukkit.command.*; +import org.bukkit.entity.*; +import org.bukkit.event.*; +import org.bukkit.event.block.*; +import org.bukkit.event.entity.*; +import org.bukkit.event.hanging.HangingBreakEvent; +import org.bukkit.event.inventory.*; +import org.bukkit.event.player.*; +import org.bukkit.generator.ChunkGenerator; +import org.bukkit.generator.WorldInfo; +import org.bukkit.inventory.*; +import org.bukkit.inventory.meta.*; +import org.bukkit.persistence.PersistentDataType; +import org.bukkit.plugin.java.JavaPlugin; +import java.io.*; +import java.nio.file.*; +import java.util.*; + +/** Separate optional lobby backend; never changes planet terrain or existing world blocks. */ +public final class DuneLobby extends JavaPlugin implements Listener, CommandExecutor { + private World lobby; + private NamespacedKey roleKey; + private final Map travelCooldown = new HashMap<>(); + private static final class TravelMenu implements InventoryHolder { + final String planet; final Inventory inventory; + TravelMenu(String planet) { this.planet=planet; inventory=Bukkit.createInventory(this,9,"Guild departure: "+planet); } + public Inventory getInventory() { return inventory; } + } + public static final class VoidGenerator extends ChunkGenerator { + @Override public void generateNoise(WorldInfo info, Random random,int x,int z,ChunkData data) {} + @Override public boolean shouldGenerateNoise() { return false; } + @Override public boolean shouldGenerateSurface() { return false; } + @Override public boolean shouldGenerateBedrock() { return false; } + @Override public boolean shouldGenerateCaves() { return false; } + @Override public boolean shouldGenerateDecorations() { return false; } + @Override public boolean shouldGenerateMobs() { return false; } + @Override public boolean shouldGenerateStructures() { return false; } + } + @Override public void onEnable() { + saveDefaultConfig(); roleKey=new NamespacedKey(this,"role"); + getCommand("lobby").setExecutor(this); getCommand("dunelobby").setExecutor(this); + Bukkit.getPluginManager().registerEvents(this,this); + Bukkit.getMessenger().registerOutgoingPluginChannel(this,"BungeeCord"); + Bukkit.getScheduler().runTask(this,()-> { + File folder=new File(Bukkit.getWorldContainer(),getConfig().getString("world","guild_lobby")); + if(new File(folder,"level.dat").isFile()) { + loadWorld(); ensureNpcs(); + if(Bukkit.getPluginManager().isPluginEnabled("ImageFrame")) Bukkit.getScheduler().runTaskLater(this,()->new LobbyArtwork(this,lobby).restore(),80); + getLogger().info("Existing Guild lobby loaded; structure left unchanged."); + } else getLogger().info("No lobby imported. Console: dunelobby build to create a NEW world."); + }); + } + private void loadWorld() { + String name=getConfig().getString("world","guild_lobby"); + if(!name.matches("[A-Za-z0-9_-]+")) throw new IllegalArgumentException("world must be a simple folder name"); + lobby=Bukkit.createWorld(new WorldCreator(name).environment(World.Environment.THE_END).generator(new VoidGenerator()).generateStructures(false)); + lobby.setSpawnLocation(new Location(lobby,.5,81,10.5,180,0)); + lobby.setGameRule(GameRule.DO_MOB_SPAWNING,false); lobby.setGameRule(GameRule.DO_FIRE_TICK,false); + lobby.setGameRule(GameRule.MOB_GRIEFING,false); lobby.setGameRule(GameRule.DO_DAYLIGHT_CYCLE,false); + lobby.setGameRule(GameRule.DO_WEATHER_CYCLE,false); lobby.setGameRule(GameRule.DO_INSOMNIA,false); + lobby.setGameRule(GameRule.KEEP_INVENTORY,true); lobby.setGameRule(GameRule.ANNOUNCE_ADVANCEMENTS,false); + lobby.setGameRule(GameRule.SPAWN_RADIUS,0); lobby.setTime(18000); lobby.setDifficulty(Difficulty.PEACEFUL); + lobby.setPVP(false); lobby.getWorldBorder().setCenter(-16,16); lobby.getWorldBorder().setSize(330); + lobby.setKeepSpawnInMemory(false); + // Keep the bounded lobby footprint loaded: NPC/art restoration must see all rooms. + for(int cx=-8;cx<=6;cx++) for(int cz=-6;cz<=8;cz++) lobby.addPluginChunkTicket(cx,cz,this); + if(lobby.getEnderDragonBattle()!=null) lobby.getEnderDragonBattle().setPreviouslyKilled(true); + } + private boolean inLobby(World world) { return lobby!=null && world.equals(lobby); } + private void ensureNpcs() { + for(int x=-8;x<=6;x++) for(int z=-6;z<=8;z++) lobby.getChunkAt(x,z).load(); + npc("liaison","Guild Navigator Liaison",0,81,-5,Villager.Profession.CLERIC); + npc("exchange","CHOAM Exchange Broker",-82,81,23,Villager.Profession.LIBRARIAN); + npc("water","Discreet Water Seller",-78,81,110,Villager.Profession.FISHERMAN); + npc("spice","Discreet Spice Seller",-54,81,110,Villager.Profession.LEATHERWORKER); + } + private void npc(String role,String name,int x,int y,int z,Villager.Profession profession) { + for(Villager entity:lobby.getEntitiesByClass(Villager.class)) if(role.equals(entity.getPersistentDataContainer().get(roleKey,PersistentDataType.STRING))) return; + lobby.spawn(new Location(lobby,x+.5,y,z+.5,180,0),Villager.class,v->{ + v.setCustomName(ChatColor.GOLD+name); v.setCustomNameVisible(true); v.setAI(false); v.setSilent(true); + v.setInvulnerable(true); v.setPersistent(true); v.setRemoveWhenFarAway(false); v.setProfession(profession); + v.setVillagerType(role.equals("water")||role.equals("spice")?Villager.Type.SWAMP:Villager.Type.DESERT); + v.getPersistentDataContainer().set(roleKey,PersistentDataType.STRING,role); v.setRecipes(List.of()); + }); + } + @Override public boolean onCommand(CommandSender sender,Command command,String label,String[] args) { + if(command.getName().equals("lobby")) { + if(sender instanceof Player p) { if(lobby==null) p.sendMessage("The Guild lobby is not loaded."); else p.teleport(lobby.getSpawnLocation()); } + return true; + } + if(args.length==0) { sender.sendMessage("/dunelobby build | artwork | verify | reload"); return true; } + switch(args[0].toLowerCase(Locale.ROOT)) { + case "build" -> { + if(sender instanceof Player) { sender.sendMessage("World creation is console-only."); return true; } + File target=new File(Bukkit.getWorldContainer(),getConfig().getString("world","guild_lobby")); + if(target.exists() || lobby!=null) { sender.sendMessage("Refusing to overwrite an existing world. Import it or choose a new world name."); return true; } + loadWorld(); long n=new LobbyBuilder(lobby).build(); ensureNpcs(); lobby.save(); + try { Files.writeString(lobby.getWorldFolder().toPath().resolve("DUNE-LOBBY.txt"),"DuneLobby 1.0.0 / Minecraft Java 1.21.4 / End void / spawn 0.5 81 10.5 yaw 180\n"); } + catch(IOException e) { getLogger().warning(e.toString()); } + sender.sendMessage("GUILD_BUILD_COMPLETE: "+n+" placements. Run dunelobby artwork, then dunelobby verify."); + } + case "artwork" -> { if(lobby!=null) new LobbyArtwork(this,lobby).install(); } + case "verify" -> { if(lobby==null) sender.sendMessage("Lobby not loaded."); else Bukkit.getScheduler().runTaskLater(this,()->verify(sender),10); } + case "reload" -> { reloadConfig(); sender.sendMessage("Rules, notices, trade prices and routing reloaded."); } + default -> sender.sendMessage("Unknown lobby operation."); + } + return true; + } + private void verify(CommandSender sender) { + List failures=new ArrayList<>(); + Location s=lobby.getSpawnLocation(); + if(lobby.getEnvironment()!=World.Environment.THE_END) failures.add("environment"); + if(!lobby.getBlockAt(s.getBlockX(),80,s.getBlockZ()).getType().isSolid() || !lobby.getBlockAt(s.getBlockX(),81,s.getBlockZ()).isPassable() || !lobby.getBlockAt(s.getBlockX(),82,s.getBlockZ()).isPassable()) failures.add("spawn clearance"); + // Flood-fill two-block-high walkable cells with step height <= 1. + Set seen=new HashSet<>(); ArrayDeque todo=new ArrayDeque<>(); todo.add(new int[]{0,81,10}); + while(!todo.isEmpty()) { + int[] p=todo.removeFirst(); String k=p[0]+","+p[1]+","+p[2]; + if(p[0]<-120||p[0]>92||p[2]<-94||p[2]>128||p[1]<79||p[1]>86||!seen.add(k)) continue; + if(!walkable(p[0],p[1],p[2])) { seen.remove(k); continue; } + for(int[] d:new int[][]{{1,0},{-1,0},{0,1},{0,-1}}) for(int dy:new int[]{0,1,-1}) { + int x=p[0]+d[0],y=p[1]+dy,z=p[2]+d[1]; + if(!seen.contains(x+","+y+","+z) && walkable(x,y,z)) { todo.add(new int[]{x,y,z}); break; } + } + } + int[][] targets={{0,81,10},{-66,81,35},{62,81,-36},{62,81,30},{-66,81,100},{-78,81,-32},{-78,81,109},{-54,81,109}}; + for(int[] p:targets) if(!seen.contains(p[0]+","+p[1]+","+p[2])) failures.add("unreachable "+Arrays.toString(p)); + for(int[] p:LobbyBuilder.PADS) if(!seen.contains(p[0]+",83,"+p[1])) failures.add("launch pad "+Arrays.toString(p)); + for(String role:List.of("liaison","exchange","water","spice")) if(lobby.getEntitiesByClass(Villager.class).stream().noneMatch(v->role.equals(v.getPersistentDataContainer().get(roleKey,PersistentDataType.STRING)))) failures.add("missing NPC "+role); + long art=lobby.getEntitiesByClass(ItemFrame.class).stream().filter(v->v.getPersistentDataContainer().has(new NamespacedKey(this,"art"),PersistentDataType.STRING)).count(); + if(art<30) failures.add("art frames "+art+" < 30"); + String result="GUILD_VERIFY "+(failures.isEmpty()?"PASS":"FAIL")+" walkable="+seen.size()+" artwork="+art+" "+failures; + sender.sendMessage(result); + try { Files.writeString(getDataFolder().toPath().resolve("verification.txt"),result+"\n"); } catch(IOException e) { getLogger().warning(e.toString()); } + } + private boolean walkable(int x,int y,int z) { + return lobby.getBlockAt(x,y-1,z).getType().isSolid() && lobby.getBlockAt(x,y,z).isPassable() && !lobby.getBlockAt(x,y,z).isLiquid() && lobby.getBlockAt(x,y+1,z).isPassable(); + } + @EventHandler public void join(PlayerJoinEvent e) { + if(lobby!=null && getConfig().getBoolean("join-at-lobby",true)) Bukkit.getScheduler().runTask(this,()->e.getPlayer().teleport(lobby.getSpawnLocation())); + } + @EventHandler public void respawn(PlayerRespawnEvent e) { if(lobby!=null && getConfig().getBoolean("respawn-at-lobby",true)) e.setRespawnLocation(lobby.getSpawnLocation()); } + @EventHandler public void move(PlayerMoveEvent e) { + if(inLobby(e.getPlayer().getWorld()) && e.getTo()!=null && e.getTo().getY()<65) e.setTo(lobby.getSpawnLocation()); + } + @EventHandler public void damage(EntityDamageEvent e) { if(inLobby(e.getEntity().getWorld())) e.setCancelled(true); } + @EventHandler public void spawn(CreatureSpawnEvent e) { + if(inLobby(e.getLocation().getWorld()) && e.getSpawnReason()!=CreatureSpawnEvent.SpawnReason.CUSTOM) e.setCancelled(true); + } + @EventHandler public void breakBlock(BlockBreakEvent e) { if(inLobby(e.getBlock().getWorld())&&!e.getPlayer().hasPermission("dunelobby.build")) e.setCancelled(true); } + @EventHandler public void placeBlock(BlockPlaceEvent e) { if(inLobby(e.getBlock().getWorld())&&!e.getPlayer().hasPermission("dunelobby.build")) e.setCancelled(true); } + @EventHandler public void explode(EntityExplodeEvent e) { if(inLobby(e.getLocation().getWorld())) e.blockList().clear(); } + @EventHandler public void blockExplode(BlockExplodeEvent e) { if(inLobby(e.getBlock().getWorld())) e.blockList().clear(); } + @EventHandler public void hanging(HangingBreakEvent e) { if(inLobby(e.getEntity().getWorld())) e.setCancelled(true); } + @EventHandler public void entityInteract(PlayerInteractEntityEvent e) { + if(!inLobby(e.getPlayer().getWorld())) return; + if(e.getRightClicked() instanceof ItemFrame) { e.setCancelled(true); return; } + String role=e.getRightClicked().getPersistentDataContainer().get(roleKey,PersistentDataType.STRING); + if(role==null) return; e.setCancelled(true); if(e.getHand()!=EquipmentSlot.HAND) return; + switch(role) { + case "liaison" -> { if(Bukkit.getPluginCommand("duneess")!=null) e.getPlayer().performCommand("duneess travel"); else departure(e.getPlayer(),"arrakis"); } + case "exchange" -> { if(Bukkit.getPluginCommand("dune")!=null) e.getPlayer().performCommand("dune exchange"); else e.getPlayer().sendMessage(ChatColor.GOLD+"CHOAM market integration requires DuneCore on this backend."); } + case "water","spice" -> trade(e.getPlayer(),role); + } + } + private void trade(Player player,String role) { + boolean water=role.equals("water"); + ItemStack result=new ItemStack(water?Material.POTION:Material.ORANGE_DYE); + ItemMeta meta=result.getItemMeta(); meta.setDisplayName(ChatColor.GOLD+(water?"Smuggled drinking water":"Smuggler spice sample")); + meta.setLore(List.of("Guild lobby barter goods","Not redeemable for Solaris or faction rewards")); + if(meta instanceof PotionMeta potion) potion.setBasePotionType(org.bukkit.potion.PotionType.WATER); + result.setItemMeta(meta); + int price=Math.max(1,Math.min(64,getConfig().getInt(water?"water-price-emeralds":"spice-price-emeralds",water?4:8))); + MerchantRecipe recipe=new MerchantRecipe(result,0,999,false,0,0f); recipe.addIngredient(new ItemStack(Material.EMERALD,price)); + Merchant merchant=Bukkit.createMerchant(water?"Discreet Water Seller":"Discreet Spice Seller"); merchant.setRecipes(List.of(recipe)); player.openMerchant(merchant,true); + } + @EventHandler public void interact(PlayerInteractEvent e) { + if(!inLobby(e.getPlayer().getWorld()) || e.getClickedBlock()==null || e.getAction()!=Action.RIGHT_CLICK_BLOCK) return; + var b=e.getClickedBlock(); e.setCancelled(true); if(e.getHand()!=EquipmentSlot.HAND) return; + int x=b.getX(),z=b.getZ(); + for(int i=0;i=p[1]-9 && z<=p[1]-7) { departure(e.getPlayer(),LobbyBuilder.PLANETS.get(i)); return; } } + if(b.getType()==Material.LECTERN) { + boolean rules=z>0; List text=getConfig().getStringList(rules?"rules":"news"); + ItemStack book=new ItemStack(Material.WRITTEN_BOOK); BookMeta meta=(BookMeta)book.getItemMeta(); meta.setTitle(rules?"Guild Charter":"Guild News"); meta.setAuthor("Spacing Guild"); + meta.setPages(text.stream().map(line->ChatColor.DARK_GRAY+line).toList()); book.setItemMeta(meta); e.getPlayer().openBook(book); + } + } + private void departure(Player player,String planet) { + TravelMenu menu=new TravelMenu(planet); ItemStack confirm=new ItemStack(Material.LIME_CONCRETE); ItemMeta meta=confirm.getItemMeta(); + meta.setDisplayName("Confirm departure: "+planet); meta.setLore(List.of("DuneEss fares and access rules apply when installed.")); confirm.setItemMeta(meta); + menu.inventory.setItem(4,confirm); player.openInventory(menu.inventory); + } + @EventHandler public void menu(InventoryClickEvent e) { + if(!(e.getView().getTopInventory().getHolder() instanceof TravelMenu menu)) return; + e.setCancelled(true); if(e.getRawSlot()!=4 || !(e.getWhoClicked() instanceof Player player)) return; + long now=System.currentTimeMillis(); if(now-travelCooldown.getOrDefault(player.getUniqueId(),0L)<5000) return; + travelCooldown.put(player.getUniqueId(),now); + Bukkit.getScheduler().runTask(this,()-> { + player.closeInventory(); + if(Bukkit.getPluginCommand("duneess")!=null) { player.performCommand("duneess travel "+menu.planet); return; } + World target=Bukkit.getWorld(menu.planet); + if(target!=null) { player.teleport(target.getSpawnLocation()); return; } + String server=getConfig().getString("servers."+menu.planet,""); + if(server.isBlank()) { player.sendMessage("No destination configured."); return; } + try { + ByteArrayOutputStream bytes=new ByteArrayOutputStream(); DataOutputStream out=new DataOutputStream(bytes); out.writeUTF("Connect"); out.writeUTF(server); + player.sendPluginMessage(this,"BungeeCord",bytes.toByteArray()); player.sendMessage("Guild departure requested. If you remain here, the destination or proxy is unavailable."); + } catch(IOException ex) { player.sendMessage("Guild departure could not be requested."); } + }); + } + @EventHandler public void drag(InventoryDragEvent e) { if(e.getView().getTopInventory().getHolder() instanceof TravelMenu) e.setCancelled(true); } + @EventHandler public void quit(PlayerQuitEvent e) { travelCooldown.remove(e.getPlayer().getUniqueId()); } + @Override public void onDisable() { if(lobby!=null) lobby.save(); } +} diff --git a/DuneLobby/src/main/java/com/example/dunelobby/LobbyArtwork.java b/DuneLobby/src/main/java/com/example/dunelobby/LobbyArtwork.java new file mode 100644 index 00000000..ac4e90ff --- /dev/null +++ b/DuneLobby/src/main/java/com/example/dunelobby/LobbyArtwork.java @@ -0,0 +1,108 @@ +package com.example.dunelobby; + +import org.bukkit.*; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.*; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.MapMeta; +import org.bukkit.map.MapView; +import org.bukkit.persistence.PersistentDataType; +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.lang.reflect.*; +import java.util.*; +import java.util.concurrent.Future; + +/** Uses ImageFrame's published loader API through reflection; no vendored third-party code. */ +final class LobbyArtwork { + private final DuneLobby plugin; + private final World world; + private final NamespacedKey key; + private static final java.util.concurrent.atomic.AtomicBoolean INSTALLING=new java.util.concurrent.atomic.AtomicBoolean(); + private static final UUID OWNER=UUID.fromString("79a66e02-e519-4489-a153-89f0037d7d11"); + private record Panel(String name,String file,int x,int y,int z,int width,int height) {} + private static final List PANELS=List.of( + new Panel("guild","guild-navigator.png",-3,85,26,6,4), + new Panel("choam","exchange.png",-88,85,20,5,3), + new Panel("expedition","spice-expedition.png",-54,85,20,5,3), + new Panel("news","news.png",57,85,-60,10,5), + new Panel("rules","rules.png",58,85,17,8,5), + new Panel("smugglers","smuggler-water-camp.png",-70,84,122,8,4), + new Panel("arrakis","world-0.png",-110,88,-87,5,4), + new Panel("giedi","world-1.png",-100,88,-87,5,4), + new Panel("kaitain","world-2.png",-90,88,-87,5,4), + new Panel("caladan","world-3.png",-68,88,-87,5,4), + new Panel("sigma","world-4.png",-58,88,-87,5,4)); + LobbyArtwork(DuneLobby plugin,World world) { this.plugin=plugin; this.world=world; key=new NamespacedKey(plugin,"art"); } + void restore() { install(); } + void install() { + if(!Bukkit.getPluginManager().isPluginEnabled("ImageFrame")) { plugin.getLogger().warning("Install ImageFrame 2026.1.5.0 to restore image decorations; structural lobby remains usable."); return; } + if(!INSTALLING.compareAndSet(false,true)) { plugin.getLogger().info("Artwork restoration is already running."); return; } + // Creation waits for ImageFrame's sync map allocation: run OFF the server thread. + Bukkit.getScheduler().runTaskAsynchronously(plugin,()-> { + try { + ClassLoader cl=Bukkit.getPluginManager().getPlugin("ImageFrame").getClass().getClassLoader(); + Class main=cl.loadClass("com.loohp.imageframe.ImageFrame"); Object manager=main.getField("imageMapManager").get(null); + Class managerType=cl.loadClass("com.loohp.imageframe.objectholders.ImageMapManager"); + // ImageFrame loads saved maps asynchronously after enable. Avoid creating duplicate + // names/map IDs while its storage is still being restored. + Object storage=managerType.getMethod("getStorage").invoke(manager); + Class storageType=cl.loadClass("com.loohp.imageframe.storage.ImageFrameStorage"); + for(int attempt=0;;attempt++) { + var saved=(Set)storageType.getMethod("getAllImageIndexes").invoke(storage); + var loaded=(Collection)managerType.getMethod("getMaps").invoke(manager); + if(loaded.size()>=saved.size()) break; + if(attempt>=60) throw new IllegalStateException("ImageFrame data did not finish loading; retry dunelobby artwork after checking its logs."); + Thread.sleep(1000); + } + Class infoType=cl.loadClass("com.loohp.imageframe.objectholders.NonUpdatableImageMapCreateInfo"); + Class mapType=cl.loadClass("com.loohp.imageframe.objectholders.NonUpdatableStaticImageMap"); + Class dithering=cl.loadClass("com.loohp.imageframe.objectholders.DitheringType"); + Object dither=dithering.getMethod("fromName",String.class).invoke(null,"floyd-steinberg"); + Class loaders=cl.loadClass("com.loohp.imageframe.objectholders.ImageMapLoaders"); + Object loader=loaders.getMethod("getLoader",Class.class,Class.class,String.class,org.bukkit.command.CommandSender.class).invoke(null,mapType,infoType,"image/png",Bukkit.getConsoleSender()); + for(Panel p:PANELS) { + String name="dune_lobby_"+p.name; + Object map=managerType.getMethod("getFromCreator",UUID.class,String.class).invoke(manager,OWNER,name); + if(map==null) { + BufferedImage original; + try(var input=plugin.getResource("artwork/"+p.file)) { if(input==null) throw new IllegalStateException("Missing artwork "+p.file); original=ImageIO.read(input); } + // Map tiles are a display-format conversion; ImageFrame stores and renders them. + BufferedImage canvas=new BufferedImage(p.width*128,p.height*128,BufferedImage.TYPE_INT_ARGB); + var g=canvas.createGraphics(); g.drawImage(original,0,0,canvas.getWidth(),canvas.getHeight(),null); g.dispose(); + BufferedImage[] tiles=new BufferedImage[p.width*p.height]; + for(int i=0;i)loader.getClass().getMethod("create",infoType).invoke(loader,info)).get(); + managerType.getMethod("addMap",cl.loadClass("com.loohp.imageframe.objectholders.ImageMap")).invoke(manager,map); + } + @SuppressWarnings("unchecked") List views=(List)map.getClass().getMethod("getMapViews").invoke(map); + Bukkit.getScheduler().callSyncMethod(plugin,()-> { mount(p,views); return null; }).get(); + } + Bukkit.getScheduler().runTask(plugin,()-> { world.save(); plugin.getLogger().info("GUILD_ARTWORK_COMPLETE: "+PANELS.size()+" ImageFrame panels installed."); }); + } catch(Exception e) { plugin.getLogger().log(java.util.logging.Level.SEVERE,"ImageFrame artwork failed",e); } + finally { INSTALLING.set(false); } + }); + } + private void mount(Panel p,List views) { + Map existing=new HashMap<>(); + for(ItemFrame frame:world.getEntitiesByClass(ItemFrame.class)) { + String tag=frame.getPersistentDataContainer().get(key,PersistentDataType.STRING); if(tag!=null) existing.put(tag,frame); + } + for(int row=0;rowf.setFacingDirection(face,true)); + frame.setVisible(false); frame.setFixed(true); frame.setInvulnerable(true); frame.setPersistent(true); + frame.getPersistentDataContainer().set(key,PersistentDataType.STRING,tag); + ItemStack item=new ItemStack(Material.FILLED_MAP); MapMeta meta=(MapMeta)item.getItemMeta(); meta.setMapView(views.get(row*p.width+col)); item.setItemMeta(meta); frame.setItem(item,false); + } + } +} diff --git a/DuneLobby/src/main/java/com/example/dunelobby/LobbyBuilder.java b/DuneLobby/src/main/java/com/example/dunelobby/LobbyBuilder.java new file mode 100644 index 00000000..25ef3cae --- /dev/null +++ b/DuneLobby/src/main/java/com/example/dunelobby/LobbyBuilder.java @@ -0,0 +1,225 @@ +package com.example.dunelobby; + +import org.bukkit.*; +import org.bukkit.block.BlockFace; +import org.bukkit.block.Sign; +import org.bukkit.block.sign.Side; +import org.bukkit.block.data.Directional; +import org.bukkit.block.data.type.Slab; +import java.util.*; + +/** Deterministic, bounded build. Coordinates are also used by the saved-world verifier. */ +final class LobbyBuilder { + static final int FLOOR = 80; + static final List PLANETS = List.of("arrakis", "caladan", "giedi_prime", "kaitain", "sigma_draconis_iv"); + static final int[][] PADS = {{-100,-73},{-78,-75},{-56,-73},{-101,-39},{-55,-39}}; + private final World w; + private long count; + LobbyBuilder(World world) { w = world; } + void block(int x,int y,int z,Material m) { w.getBlockAt(x,y,z).setType(m,false); count++; } + void box(int x1,int y1,int z1,int x2,int y2,int z2,Material m) { + for(int x=x1;x<=x2;x++) for(int z=z1;z<=z2;z++) for(int y=y1;y<=y2;y++) block(x,y,z,m); + } + private boolean inside(int x,int z,int rx,int rz) { + return Math.abs(x)<=rx && Math.abs(z)<=rz && Math.abs(x)+Math.abs(z)<=rx+rz-5; + } + /** Octagonal rooms, glazed clerestories, stepped barrel vaults, repeated ribs. */ + private void room(int cx,int cz,int rx,int rz,int height,boolean shady) { + for(int x=-rx;x<=rx;x++) for(int z=-rz;z<=rz;z++) { + if(!inside(x,z,rx,rz)) continue; + boolean edge = !inside(x+1,z,rx,rz)||!inside(x-1,z,rx,rz)||!inside(x,z+1,rx,rz)||!inside(x,z-1,rx,rz); + block(cx+x,78,cz+z,Material.DEEPSLATE_TILES); + block(cx+x,79,cz+z,Material.POLISHED_BLACKSTONE_BRICKS); + Material floor = (Math.floorMod(x,8)==0 || Math.floorMod(z,8)==0) ? Material.POLISHED_BLACKSTONE : Material.DEEPSLATE_TILES; + if(Math.abs(x)==rx-2 || Math.abs(z)==rz-2) floor=shady?Material.WAXED_WEATHERED_COPPER:Material.WAXED_CUT_COPPER; + block(cx+x,80,cz+z,floor); + int roof = FLOOR+height-(int)Math.round(7.0*Math.pow(Math.abs(x)/(double)rx,2)); + block(cx+x,roof,cz+z,Material.POLISHED_BLACKSTONE_BRICKS); + if(Math.floorMod(z+rz,8)==0) { + block(cx+x,roof-1,cz+z,Material.DEEPSLATE_BRICKS); + if(Math.abs(x)%9==0) block(cx+x,roof-2,cz+z,Material.WAXED_CUT_COPPER); + } + if(edge) for(int y=81;y=85 && y<=roof-4) m=Material.PURPLE_STAINED_GLASS; + if(y==84 || y==roof-3) m=Material.WAXED_CUT_COPPER; + if(Math.floorMod(x+z,8)==0) m=Material.DEEPSLATE_BRICKS; + block(cx+x,y,cz+z,m); + } + } + for(int x=-rx+7;x<=rx-7;x+=8) for(int z=-rz+7;z<=rz-7;z+=8) { + if(!shady || Math.floorMod(x+z,3)==0) lamp(cx+x,81,cz+z,shady); + } + // Gold centre stripe serves as a continuous wayfinding route. + for(int z=-rz+4;z<=rz-4;z++) block(cx,80,cz+z,shady?Material.WAXED_WEATHERED_COPPER:Material.GOLD_BLOCK); + } + private void lamp(int x,int y,int z,boolean dim) { + block(x,y,z,Material.POLISHED_BLACKSTONE_BRICK_WALL); + block(x,y+1,z,dim?Material.SOUL_LANTERN:Material.LANTERN); + } + private void corridor(int x1,int z1,int x2,int z2,boolean shady) { + int minX=Math.min(x1,x2)-3,maxX=Math.max(x1,x2)+3,minZ=Math.min(z1,z2)-3,maxZ=Math.max(z1,z2)+3; + box(minX,78,minZ,maxX,80,maxZ,Material.DEEPSLATE_TILES); + box(minX,81,minZ,maxX,87,maxZ,Material.AIR); + box(minX,88,minZ,maxX,88,maxZ,Material.DEEPSLATE_BRICKS); + for(int x=minX;x<=maxX;x++) for(int z=minZ;z<=maxZ;z++) { + if((x1==x2 && (x==minX||x==maxX)) || (z1==z2 && (z==minZ||z==maxZ))) { + // Leave junctions open wherever another supported floor joins this edge. + int outsideX=x+(x1==x2?(x==minX?-1:1):0); + int outsideZ=z+(z1==z2?(z==minZ?-1:1):0); + if(w.getBlockAt(outsideX,80,outsideZ).getType().isSolid()) continue; + block(x,81,z,Material.POLISHED_BLACKSTONE_BRICK_WALL); + block(x,82,z,Material.POLISHED_BLACKSTONE_BRICK_WALL); + if(Math.floorMod(x+z,6)==0) { + block(x,83,z,shady?Material.SOUL_LANTERN:Material.LANTERN); + box(x,84,z,x,87,z,Material.CHAIN); + } + } else if((x1==x2 && x==x1)||(z1==z2 && z==z1)) block(x,80,z,shady?Material.WAXED_WEATHERED_COPPER:Material.GOLD_BLOCK); + } + } + void sign(int x,int y,int z,BlockFace face,String... lines) { + block(x,y,z,Material.DARK_OAK_WALL_SIGN); + Directional d=(Directional)w.getBlockAt(x,y,z).getBlockData(); d.setFacing(face); w.getBlockAt(x,y,z).setBlockData(d,false); + Sign s=(Sign)w.getBlockAt(x,y,z).getState(); + for(int i=0;i=9.5 && r<=10.5)||(r>=3.5&&r<=4.5)) block(x,80,z,Material.GOLD_BLOCK); + } + } + private void pad(int cx,int cz,int radius,int y,boolean launch,int number) { + box(cx-radius-1,80,cz-radius-1,cx+radius+1,y,cz+radius+1,Material.GRAY_CONCRETE); + for(int x=-radius;x<=radius;x++) for(int z=-radius;z<=radius;z++) { + Material m=Material.POLISHED_BASALT; + if(Math.abs(x)==radius || Math.abs(z)==radius) m=Math.floorMod(x+z,4)<2?Material.YELLOW_CONCRETE:Material.BLACK_CONCRETE; + if((Math.abs(x)<=1 && Math.abs(z)<=radius-2)||(Math.abs(z)<=1 && Math.abs(x)<=radius-2)) m=Material.SMOOTH_QUARTZ; + block(cx+x,y,cz+z,m); + } + for(int s:new int[]{-1,1}) for(int t:new int[]{-1,1}) { block(cx+s*radius,y+1,cz+t*radius,Material.LANTERN); } + if(launch) { + box(cx-2,81,cz+radius+1,cx+2,81,cz+radius+2,Material.SMOOTH_STONE); + box(cx-2,81,cz+radius+3,cx+2,81,cz+radius+3,Material.SMOOTH_STONE_SLAB); + box(cx-2,83,cz-radius-2,cx+2,84,cz-radius-2,Material.WAXED_CUT_COPPER); + block(cx,85,cz-radius-2,Material.LANTERN); + sign(cx,84,cz-radius-1,BlockFace.SOUTH,"DEPARTURE 0"+number,PLANETS.get(number-1).replace('_',' '),"Right-click console","Confirm destination"); + } + } + private void starport() { + pad(-78,-53,10,80,false,0); + for(int i=0;i