Merge pull request 'Release verified DuneRealms development build' (#612) from dev/MC:work/gui-commands-unified-pack into main

This commit is contained in:
unimatrix 2026-11-28 15:44:36 +00:00
commit f03e007dce
204 changed files with 8407 additions and 259 deletions

View file

@ -1,7 +1,46 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {readFileSync} from 'node:fs';
test('feature branch CI never invokes production deployment',()=>{
const workflow=readFileSync(new URL('../workflows/web-deploy.yml',import.meta.url),'utf8');
assert.match(workflow,/- name: Trigger deployment after successful CI\r?\n\s+if: github\.ref == 'refs\/heads\/main'/);
const workflow = readFileSync(new URL('../workflows/web-deploy.yml', import.meta.url), 'utf8');
const steps = new Map(
workflow.split(/^ - name: /m).slice(1).map(chunk => {
const lineEnd = chunk.indexOf('\n');
return [chunk.slice(0, lineEnd).trim(), chunk.slice(lineEnd + 1)];
})
);
const production = "github.repository == 'unimatrix/MC' && github.ref == 'refs/heads/main'";
function step(name) {
assert.ok(steps.has(name), 'Expected workflow step: ' + name);
return steps.get(name);
}
test('development can dispatch a build and production still builds on main pushes', () => {
assert.match(workflow, /^ workflow_dispatch:\s*$/m);
assert.match(workflow, /^ push:\r?\n branches:\r?\n - main\r?$/m);
assert.equal(workflow.match(/^ if: (.+)$/m)?.[1].trim(),
"github.repository == 'unimatrix/MC' || (github.repository == 'dev/MC' && github.event_name == 'workflow_dispatch')");
for (const name of ['Verify deployment policy', 'Build and test website']) {
assert.doesNotMatch(step(name), /^ if:/m);
}
});
test('checkout fetches the exact event commit from the repository running the workflow', () => {
const checkout = step('Check out exact revision');
assert.match(checkout, /fetch --depth=1 "https:\/\/www\.dunerealms\.com\/git\/\$\{GITHUB_REPOSITORY\}\.git" "\$GITHUB_SHA"/);
assert.match(checkout, /git checkout --detach FETCH_HEAD\r?\n\s+test "\$\(git rev-parse HEAD\)" = "\$GITHUB_SHA"/);
assert.doesNotMatch(checkout, /unimatrix\/MC/);
});
test('publication comparison, artifact upload and deployment require canonical main', () => {
for (const name of ['Prepare publication comparison', 'Upload website build', 'Trigger deployment after successful CI']) {
assert.equal(step(name).match(/^ if: (.+)$/m)?.[1].trim(), production);
}
assert.match(step('Prepare publication comparison'), /publication-changes\.mjs "\$BEFORE" "\$GITHUB_SHA"/);
assert.match(step('Upload website build'), /uses: actions\/upload-artifact@v3/);
assert.match(step('Trigger deployment after successful CI'), /StrictHostKeyChecking=yes[^\n]+"\$GITHUB_SHA"/);
for (const [name, body] of steps) {
if (name !== 'Trigger deployment after successful CI') assert.doesNotMatch(body, /DUNEREALMS_DEPLOY_KEY|ssh .*dunedeploy@/);
}
});

View file

@ -8,6 +8,7 @@ on:
- 'Dune*/**'
- 'JarvisConnector/**'
- 'gui-common/**'
- 'network/proxy/central-pack/**'
jobs:
plugins:
@ -20,7 +21,7 @@ jobs:
run: |
set -euo pipefail
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/MC.git "$GITHUB_SHA"
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 "https://www.dunerealms.com/git/${GITHUB_REPOSITORY}.git" "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
- uses: actions/setup-java@v4
with:
@ -34,6 +35,9 @@ jobs:
run: |
set -euo pipefail
modules=(DuneEss DuneLobby DuneNPC DuneRealms-minecraft-only DuneRealmsGUI DuneTerrain JarvisConnector)
if [[ -f network/proxy/central-pack/build.gradle.kts ]]; then
modules+=(network/proxy/central-pack)
fi
mkdir -p plugin-artifacts
for module in "${modules[@]}"; do
gradle --no-daemon -p "$module" test jar
@ -51,3 +55,37 @@ jobs:
name: DuneRealms-Plugins
path: plugin-artifacts/
if-no-files-found: error
- name: Test and build the replacement DuneMenus plugin
shell: bash
run: |
set -euo pipefail
gradle --no-daemon -p DuneMenus test jar
mkdir -p dunemenus-artifacts
cp DuneMenus/build/libs/DuneMenus.jar dunemenus-artifacts/
printf '%s\n' "$(git rev-parse HEAD)" > dunemenus-artifacts/SOURCE_COMMIT
(cd dunemenus-artifacts && sha256sum -- DuneMenus.jar SOURCE_COMMIT > SHA256SUMS)
- uses: actions/upload-artifact@v3
with:
name: ${{ github.repository == 'dev/MC' && 'DuneMenus-Development' || 'DuneMenus' }}
path: dunemenus-artifacts/
if-no-files-found: error
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '25'
- name: Build optional Paper 26.2 fullscreen provider
shell: bash
run: |
set -euo pipefail
gradle --no-daemon -p DuneFullscreenPaper test jar
mkdir -p fullscreen-artifacts
cp DuneFullscreenPaper/build/libs/DuneFullscreenPaper.jar fullscreen-artifacts/
printf '%s\n' "$(git rev-parse HEAD)" > fullscreen-artifacts/SOURCE_COMMIT
(cd fullscreen-artifacts && sha256sum -- DuneFullscreenPaper.jar SOURCE_COMMIT > SHA256SUMS)
- uses: actions/upload-artifact@v3
with:
name: DuneRealms-Fullscreen-Paper-Development
path: fullscreen-artifacts/
if-no-files-found: error

View file

@ -1,5 +1,6 @@
name: DuneRealms Resourcepack CI
on:
workflow_dispatch:
push:
branches: [main]
paths:
@ -16,6 +17,7 @@ on:
- '.forgejo/workflows/resourcepack-ci.yml'
jobs:
resourcepack:
if: github.repository == 'unimatrix/MC' && github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: dune-ci
steps:
- name: Checkout exact reviewed revision
@ -63,3 +65,49 @@ jobs:
JarvisConnector/build/libs/jarvistranslator.jar
if-no-files-found: error
retention-days: 7
central-pack-development:
if: github.repository == 'dev/MC' && github.event_name == 'workflow_dispatch'
runs-on: dune-ci
steps:
- name: Check out exact development revision
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 "https://www.dunerealms.com/git/${GITHUB_REPOSITORY}.git" "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: Verify baseline and build a central pack candidate
shell: bash
run: |
set -euo pipefail
node --test tools/build-planet-texture-packs.test.mjs
curl --fail --location --retry 2 https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v6.zip -o central-pack-baseline.zip
python3 - <<'PYTHON'
import pathlib
import runpy
repair = runpy.run_path('tools/build-resourcepack-repair.py')
entries = repair['read_pack'](
pathlib.Path('central-pack-baseline.zip'),
'ed2533646ee5e19a1dbfeec66e5791d1011a5107e6fcc4153372e431dfc5f56a',
)
for name, data in entries.items():
target = pathlib.Path('central-pack-base') / name
target.parent.mkdir(parents=True, exist_ok=True)
target.write_bytes(data)
PYTHON
node tools/build-central-resource-pack.mjs central-pack-base central-pack-output 6 network/resource-pack/shared
printf '%s\n' "$GITHUB_SHA" > central-pack-output/SOURCE_COMMIT
(cd central-pack-output && sha256sum -- *.zip central-pack-manifest.json SOURCE_COMMIT > SHA256SUMS)
- uses: actions/upload-artifact@v3
with:
name: DuneRealms-Central-Pack-Development
path: central-pack-output/
if-no-files-found: error
retention-days: 7

View file

@ -7,20 +7,24 @@ on:
paths:
- 'website/**'
- '.forgejo/workflows/web-deploy.yml'
- '.forgejo/tests/web-deploy.test.mjs'
workflow_dispatch:
jobs:
web:
if: github.repository == 'unimatrix/MC' || (github.repository == 'dev/MC' && github.event_name == 'workflow_dispatch')
runs-on: dune-ci
steps:
- name: Checkout
- name: Check out exact revision
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/MC.git "$GITHUB_SHA"
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 "https://www.dunerealms.com/git/${GITHUB_REPOSITORY}.git" "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
- name: Install Node 22
uses: actions/setup-node@v4
@ -28,6 +32,7 @@ jobs:
node-version: '22'
- name: Prepare publication comparison
if: github.repository == 'unimatrix/MC' && github.ref == 'refs/heads/main'
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -56,7 +61,7 @@ jobs:
node --test --test-concurrency=1 ../tools/tests/*.test.mjs
- name: Upload website build
if: github.ref == 'refs/heads/main'
if: github.repository == 'unimatrix/MC' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: DuneRealms-Website
@ -65,7 +70,7 @@ jobs:
retention-days: 1
- name: Trigger deployment after successful CI
if: github.ref == 'refs/heads/main'
if: github.repository == 'unimatrix/MC' && github.ref == 'refs/heads/main'
shell: bash
env:
DEPLOY_KEY: ${{ secrets.DUNEREALMS_DEPLOY_KEY }}

View file

@ -27,7 +27,7 @@ final class EssentialsBasics implements CommandExecutor, TabCompleter, Listener
}
void register() {
homeTravel=new PersonalHomeTravel(plugin);
for(String name:List.of("home","sethome","delhome","homes","tpa","tpaccept","tpdeny","spawn","server","essentials")) {
for(String name:List.of("home","rescue","sethome","delhome","homes","tpa","tpaccept","tpdeny","spawn","server","essentials")) {
PluginCommand command=Objects.requireNonNull(plugin.getCommand(name));
command.setExecutor(this); command.setTabCompleter(this);
}
@ -38,10 +38,29 @@ final class EssentialsBasics implements CommandExecutor, TabCompleter, Listener
if(args.length>1 || !name.matches("[a-z0-9_-]{1,24}")) throw new IllegalArgumentException("Use a home name with 1–24 letters, numbers, underscores or hyphens.");
return name;
}
private record HomeAddress(String name,boolean explicitWorld) {}
private static HomeAddress address(Player player,String[] args){
if(args.length!=2)return new HomeAddress(homeName(args),false);
if(!player.getWorld().getName().equalsIgnoreCase(args[0])){
throw new IllegalArgumentException("Use the Spacing Guild Navigator to reach "+args[0]+" first.");
}
return new HomeAddress(homeName(new String[]{args[1]}),true);
}
private String worldKey(Player player,String name){
return "worldHomes."+player.getUniqueId()+"."+player.getWorld().getUID()+"."+name;
}
private Location location(Player player,String name){
Location current=homes.getLocation(worldKey(player,name));
return current!=null?current:homes.getLocation(key(player,name));
}
private String key(Player p,String name) { return p.getUniqueId()+"."+name; }
private Set<String> names(Player p) {
var section=homes.getConfigurationSection(p.getUniqueId().toString());
return section==null?Set.of():section.getKeys(false);
var world=homes.getConfigurationSection("worldHomes."+p.getUniqueId()+"."+p.getWorld().getUID());
Set<String> result=new TreeSet<>();
if(section!=null)result.addAll(section.getKeys(false));
if(world!=null)result.addAll(world.getKeys(false));
return result;
}
private void save() throws IOException {
Path target=file.toPath(), temp=target.resolveSibling("homes.yml.tmp");
@ -84,13 +103,19 @@ final class EssentialsBasics implements CommandExecutor, TabCompleter, Listener
case "essentials" -> menu(p);
case "homes" -> homeMenu(p);
case "sethome" -> {
String name=homeName(args), path=key(p,name);
if(!homes.contains(path) && names(p).size()>=Math.max(1,plugin.getConfig().getInt("essentials.max-homes",3))) throw new IllegalArgumentException("Your home limit has been reached.");
HomeAddress address=address(p,args);String name=address.name(),path=address.explicitWorld()?worldKey(p,name):key(p,name);
if(!names(p).contains(name) && names(p).size()>=Math.max(1,plugin.getConfig().getInt("essentials.max-homes",3))) throw new IllegalArgumentException("Your home limit has been reached.");
homes.set(path,p.getLocation()); save(); p.sendMessage("Home saved: "+name);
}
case "home" -> homeTravel.begin(p,homes.getLocation(key(p,homeName(args))));
case "rescue" -> {if(args.length!=0)throw new IllegalArgumentException("Use /rescue for emergency travel.");homeTravel.rescue(p,location(p,"home"));}
case "home" -> {
HomeAddress address=address(p,args);
Location destination=location(p,address.name());
if(address.explicitWorld()||homes.contains(worldKey(p,address.name())))homeTravel.worldHome(p,destination);
else homeTravel.begin(p,destination);
}
case "delhome" -> {
String name=homeName(args),path=key(p,name);
HomeAddress address=address(p,args);String name=address.name(),scoped=worldKey(p,name),path=address.explicitWorld()||homes.contains(scoped)?scoped:key(p,name);
if(!homes.contains(path)) throw new IllegalArgumentException("That home does not exist.");
homes.set(path,null); save(); p.sendMessage("Home removed: "+name);
}
@ -124,9 +149,12 @@ final class EssentialsBasics implements CommandExecutor, TabCompleter, Listener
return true;
}
@Override public List<String> onTabComplete(CommandSender sender,Command command,String alias,String[] args) {
if(!(sender instanceof Player p) || args.length!=1) return List.of();
if(!(sender instanceof Player p))return List.of();
if(args.length==2&&Set.of("home","delhome").contains(command.getName())&&p.getWorld().getName().equalsIgnoreCase(args[0]))return names(p).stream().filter(n->n.startsWith(args[1].toLowerCase(Locale.ROOT))).toList();
if(args.length!=1)return List.of();
Collection<String> values=switch(command.getName()) {
case "home","delhome" -> names(p);
case "home","delhome" -> {var choices=new TreeSet<>(names(p));choices.add(p.getWorld().getName());yield choices;}
case "sethome" -> List.of(p.getWorld().getName());
case "tpa" -> Bukkit.getOnlinePlayers().stream().filter(p::canSee).map(Player::getName).toList();
case "server" -> List.of("arrakis","giedi_prime","caladan","kaitain","sigma_draconis_iv","spacing_guild");
default -> List.of();

View file

@ -30,28 +30,49 @@ final class PersonalHomeTravel implements Listener {
try{Files.move(temp,file,StandardCopyOption.ATOMIC_MOVE,StandardCopyOption.REPLACE_EXISTING);}catch(AtomicMoveNotSupportedException e){Files.move(temp,file,StandardCopyOption.REPLACE_EXISTING);}
}
private boolean persist(){try{save();return true;}catch(Exception e){journal=YamlConfiguration.loadConfiguration(file.toFile());plugin.getLogger().warning("Home delivery journal could not be saved; no new travel will be started.");return false;}}
void begin(Player p,Location destination){
void begin(Player p,Location destination){begin(p,destination,"");}
void worldHome(Player p,Location destination){begin(p,destination,"world");}
void rescue(Player p,Location destination){
if(destination==null||!p.getWorld().equals(destination.getWorld())||!safe(destination)){
destination=p.getWorld().getSpawnLocation();
}
if(!safe(destination)){p.sendMessage("No safe rescue destination is available on this world.");return;}
begin(p,destination,"rescue");
}
private static boolean safe(Location at){
if(!valid(at)||!at.getWorld().isChunkLoaded(at.getBlockX()>>4,at.getBlockZ()>>4))return false;
var feet=at.getBlock();
var head=feet.getRelative(org.bukkit.block.BlockFace.UP);
var floor=feet.getRelative(org.bukkit.block.BlockFace.DOWN);
return feet.getType().isAir()&&head.getType().isAir()&&floor.getType().isSolid()&&
!Set.of(Material.MAGMA_BLOCK,Material.CACTUS,Material.CAMPFIRE,Material.SOUL_CAMPFIRE).contains(floor.getType());
}
private void begin(Player p,Location destination,String mode){
boolean rescue=mode.equals("rescue");
if(!valid(destination)){p.sendMessage("That saved home is unavailable or outside the world's playable bounds.");return;}
if(!p.getWorld().equals(destination.getWorld())){p.sendMessage("Travel to that world through the Guild first, then use /home.");return;}
String id=p.getUniqueId().toString();if(waiting.containsKey(p.getUniqueId())||journal.contains(id)){p.sendMessage("Your home journey is already being completed.");return;}
var connector=Bukkit.getPluginManager().getPlugin("JarvisTranslator");if(connector==null||!connector.isEnabled()){p.sendMessage("Central home travel is unavailable. No payment was made.");return;}
UUID token=UUID.randomUUID(),world=p.getWorld().getUID();waiting.put(p.getUniqueId(),token);Location target=destination.clone();
p.sendMessage("Home travel in 5 seconds · 25 DM · 15 minute cooldown.");
Bukkit.getScheduler().runTaskLater(plugin,()->{
if(!rescue)p.sendMessage(mode.equals("world")?"World home travel in 5 seconds · Spacing Guild tariff · 24-hour cooldown.":"Home travel in 5 seconds · 25 DM · 15 minute cooldown.");
Runnable reserve=()->{
if(!token.equals(waiting.remove(p.getUniqueId()))||!p.isOnline())return;
if(!world.equals(p.getWorld().getUID())||p.isDead()||!valid(target)){p.sendMessage("Home travel cancelled. No payment was made.");return;}
journal.set(id+".requestId",token.toString());journal.set(id+".destination",target);journal.set(id+".stage","reserve");
journal.set(id+".requestId",token.toString());journal.set(id+".destination",target);journal.set(id+".stage","reserve");journal.set(id+".mode",mode);
try{journal.set(id+".destinationHash",HexFormat.of().formatHex(MessageDigest.getInstance("SHA-256").digest((target.getWorld().getUID()+":"+target.getX()+":"+target.getY()+":"+target.getZ()+":"+target.getYaw()+":"+target.getPitch()).getBytes(StandardCharsets.UTF_8))));}catch(Exception e){throw new IllegalStateException(e);}
if(persist())attempt(id);
},100);
};
if(rescue)reserve.run();else Bukkit.getScheduler().runTaskLater(plugin,reserve,100);
}
private void recover(){for(String id:new HashSet<>(journal.getKeys(false)))attempt(id);}
private void stage(String id,String value){journal.set(id+".stage",value);persist();}
private void attempt(String id){
if(!busy.add(id))return;
String mode=journal.getString(id+".mode","");
boolean rescue=mode.equals("rescue");
String stage=journal.getString(id+".stage");Player player=Bukkit.getPlayer(UUID.fromString(id));
// Keep a pre-payment instruction after a lost reply; retry it with exactly the same reference.
var input=new JsonObject();input.addProperty("action",stage);input.addProperty("requestId",journal.getString(id+".requestId"));input.addProperty("destinationHash",journal.getString(id+".destinationHash"));
var input=new JsonObject();input.addProperty("action",stage);input.addProperty("requestId",journal.getString(id+".requestId"));input.addProperty("destinationHash",journal.getString(id+".destinationHash"));if(!mode.isEmpty())input.addProperty("mode",mode);
var connector=Bukkit.getPluginManager().getPlugin("JarvisTranslator");if(connector==null||!connector.isEnabled()){busy.remove(id);return;}
Bukkit.getScheduler().runTaskAsynchronously(plugin,()->{
JsonObject result=null;try{result=JsonParser.parseString((String)connector.getClass().getMethod("requestHome",UUID.class,String.class).invoke(connector,UUID.fromString(id),input.toString())).getAsJsonObject();}catch(Exception ignored){}
@ -70,11 +91,17 @@ final class PersonalHomeTravel implements Listener {
if(!state.equals("pending")){journal.set(id,null);persist();return;}
if(!stage.equals("reserve"))return;
Player current=Bukkit.getPlayer(UUID.fromString(id));Location target=journal.getLocation(id+".destination");
if(current==null||!current.isOnline()||current.isDead()||!valid(target)||!current.getWorld().equals(target.getWorld())){stage(id,"cancel");return;}
if(current==null||!current.isOnline()||current.isDead()||!valid(target)||rescue&&!safe(target)||!current.getWorld().equals(target.getWorld())){stage(id,"cancel");return;}
// Keep the busy latch until the actual native result. Crash recovery re-delivers the same destination.
current.teleportAsync(target).whenComplete((success,failure)->Bukkit.getScheduler().runTask(plugin,()->{
stage(id,Boolean.TRUE.equals(success)&&failure==null?"arrive":"cancel");busy.remove(id);
if(current.isOnline())current.sendMessage(Boolean.TRUE.equals(success)&&failure==null?"Home reached · 25 DM · 15 minute cooldown.":"Home travel failed. Your reservation will be released.");attempt(id);
boolean arrived=Boolean.TRUE.equals(success)&&failure==null;
stage(id,arrived?"arrive":"cancel");busy.remove(id);
if(arrived&&rescue&&current.isOnline()&&!current.isDead()){
var health=current.getAttribute(org.bukkit.attribute.Attribute.MAX_HEALTH);
if(health!=null)current.setHealth(health.getValue());
current.setFireTicks(0);current.setFallDistance(0);
}
if(current.isOnline())current.sendMessage(arrived&&mode.equals("world")?"World home reached · "+String.format(Locale.ROOT,"%.2f DM",response.get("fareMinor").getAsLong()/100.0)+" · 24-hour cooldown.":arrived?(rescue?"Emergency rescue complete · 1,000 DM · 24-hour cooldown.":"Home reached · 25 DM · 15 minute cooldown."):"Teleport failed. Your reservation will be released.");attempt(id);
}));
teleporting=true;
return;

View file

@ -33,11 +33,16 @@ commands:
essentials:
description: Open DuneRealms Essentials
permission: duneess.basics
rescue:
description: Emergency teleport and heal for 1,000 DM
usage: /rescue
home:
description: Teleport to a saved home
description: Teleport to a saved home on your current world
usage: /home [world] [name]
permission: duneess.basics
sethome:
description: Save a named home
description: Save a named home on your current world
usage: /sethome [world] [name]
permission: duneess.basics
delhome:
description: Remove a named home

View file

@ -0,0 +1,7 @@
# Optional Paper fullscreen roleplay provider
DuneGit builds this provider as a separate development artifact. It requires Paper 26.2 build 135 and Java 25. Build `DuneRealmsGUI` first, then run `gradle -p DuneFullscreenPaper test jar` with Java 25 and Gradle 9.2.1.
The Java Decisions dashboard uses this provider only for UUIDs listed under `development.fullscreen-decisions-viewers` in the DunerealmsGUI config. Quest dashboards, turn-ins and next-mission screens use `development.fullscreen-quest-viewers`. Branded organisation modules use `development.fullscreen-organisation-viewers`, Exchange browse, listing and kit shelves, plus loose-item and kit checkout, use `development.fullscreen-exchange-viewers`, and House or Mentat screens use `development.fullscreen-house-viewers`. Keep these allowlists empty on live servers. Existing menus handle unavailable providers, invalid card slots, documents outside the 54-card inventory limit, and quest text that exceeds the native layout.
Larger documents retain their server-provided slots and show four entries per page in Decisions, quests and organisation modules, and six in Exchange and House views. The mounted view can still expose vanilla overlays such as the experience bar, crosshair, chat and system notifications.

View file

@ -0,0 +1,22 @@
plugins {
java
id("io.papermc.paperweight.userdev") version "2.0.0-beta.23"
}
dependencies {
paperweight.paperDevBundle("26.2.build.135-stable")
compileOnly(files("../DuneRealmsGUI/build/libs/DunerealmsGUI.jar"))
testImplementation("org.junit.jupiter:junit-jupiter:5.11.4")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
repositories { mavenCentral() }
// Teardown tests exercise the provider's lifecycle without bootstrapping a Paper server.
configurations.testRuntimeClasspath {
exclude(group = "io.papermc.paper", module = "dev-bundle")
}
tasks.test { useJUnitPlatform() }
java { toolchain.languageVersion.set(JavaLanguageVersion.of(25)) }
tasks.withType<JavaCompile>().configureEach { options.encoding = "UTF-8" }
tasks.jar { archiveFileName.set("DuneFullscreenPaper.jar") }

View file

@ -0,0 +1,7 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://repo.papermc.io/repository/maven-public/")
}
}
rootProject.name = "DuneFullscreenPaper"

View file

@ -0,0 +1,34 @@
package com.dunerealms.fullscreen;
import com.dunerealms.gui.DecisionsViewTransport;
import io.papermc.paper.ServerBuildInfo;
import org.bukkit.Bukkit;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
public final class FullscreenProvider extends JavaPlugin {
private PaperDecisionsScene scenes;
@Override
public void onEnable() {
var build = ServerBuildInfo.buildInfo();
if (!build.minecraftVersionId().equals("26.2") || build.buildNumber().orElse(-1) != 135 ||
!build.isBrandCompatible(ServerBuildInfo.BRAND_PAPER_ID)) {
getLogger().info("Fullscreen Decisions requires Paper 26.2 build 135.");
return;
}
try {
scenes = new PaperDecisionsScene(this);
Bukkit.getPluginManager().registerEvents(scenes, this);
Bukkit.getServicesManager().register(DecisionsViewTransport.class, scenes, this, ServicePriority.Normal);
} catch (LinkageError unavailable) {
getLogger().warning("Fullscreen Decisions runtime is unavailable: " + unavailable.getClass().getSimpleName());
}
}
@Override
public void onDisable() {
Bukkit.getServicesManager().unregisterAll(this);
if (scenes != null) scenes.close();
}
}

View file

@ -0,0 +1,48 @@
package com.dunerealms.fullscreen;
import java.util.UUID;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.function.Supplier;
final class SceneTeardown {
private SceneTeardown() {}
record Position(UUID world, double x, double y, double z) {}
static boolean restore(Position saved, BooleanSupplier teleport, Supplier<Position> current) {
return teleport.getAsBoolean() && saved.equals(current.get());
}
static void run(BooleanSupplier restore, Runnable select, Runnable dismiss, Runnable rejected,
Consumer<Throwable> report, Runnable... cleanup) {
boolean clean = true;
for (Runnable step : cleanup) {
try {
step.run();
} catch (RuntimeException | LinkageError failure) {
clean = false;
report.accept(failure);
}
}
boolean restored = false;
try {
restored = restore.getAsBoolean();
} catch (RuntimeException | LinkageError failure) {
report.accept(failure);
}
if (select != null && restored && clean) {
try {
select.run();
} catch (RuntimeException | LinkageError failure) {
dismiss.run();
report.accept(failure);
}
} else {
dismiss.run();
if (select != null || !restored) rejected.run();
}
}
}

View file

@ -0,0 +1,5 @@
name: DuneFullscreenPaper
main: com.dunerealms.fullscreen.FullscreenProvider
version: 0.1.0
api-version: '26.2'
depend: [DunerealmsGUI]

View file

@ -0,0 +1,62 @@
package com.dunerealms.fullscreen;
import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.junit.jupiter.api.Test;
class SceneTeardownTest {
private final SceneTeardown.Position saved = new SceneTeardown.Position(UUID.randomUUID(), 10.5, 64, 7.5);
@Test void cancelledReturnDoesNotRunSelection() {
assertRejected(() -> SceneTeardown.restore(saved, () -> false, () -> saved));
}
@Test void redirectedReturnDoesNotRunSelection() {
assertRejected(() -> SceneTeardown.restore(saved, () -> true, () -> new SceneTeardown.Position(saved.world(), 10.5, 70, 7.5)));
}
@Test void returnToSameCoordinatesInAnotherWorldDoesNotRunSelection() {
assertRejected(() -> SceneTeardown.restore(saved, () -> true,
() -> new SceneTeardown.Position(UUID.randomUUID(), saved.x(), saved.y(), saved.z())));
}
@Test void exactReturnRunsSelectionOnceAfterCleanup() {
var calls = new ArrayList<String>();
SceneTeardown.run(() -> SceneTeardown.restore(saved, () -> true, () -> saved),
() -> calls.add("selected"), () -> fail("Unexpected dismissal"), () -> fail("Unexpected rejection"),
failure -> fail(failure), () -> calls.add("cleanup"));
assertEquals(List.of("cleanup", "selected"), calls);
}
@Test void cleanupFailureStillRestoresAndReleasesSession() {
var calls = new ArrayList<String>();
SceneTeardown.run(() -> { calls.add("restored"); return true; }, () -> fail("Unsafe selection"),
() -> calls.add("dismissed"), () -> calls.add("rejected"), failure -> calls.add("reported"),
() -> { throw new IllegalStateException("failed to restore camera"); },
() -> calls.add("removed entities"));
assertEquals(List.of("reported", "removed entities", "restored", "dismissed", "rejected"), calls);
}
@Test void restorationExceptionStillReleasesSession() {
var calls = new ArrayList<String>();
SceneTeardown.run(() -> { throw new IllegalStateException("teleport failed"); }, null,
() -> calls.add("dismissed"), () -> calls.add("rejected"), failure -> calls.add("reported"));
assertEquals(List.of("reported", "dismissed", "rejected"), calls);
}
@Test void incomingTeleportReleaseLeavesDestinationAlone() {
var calls = new ArrayList<String>();
SceneTeardown.run(() -> true, null, () -> calls.add("dismissed"),
() -> fail("Unexpected rejection"), failure -> fail(failure), () -> calls.add("cleanup"));
assertEquals(List.of("cleanup", "dismissed"), calls);
}
private void assertRejected(java.util.function.BooleanSupplier restoration) {
var calls = new ArrayList<String>();
SceneTeardown.run(restoration, () -> fail("Unsafe selection"), () -> calls.add("dismissed"),
() -> calls.add("rejected"), failure -> fail(failure));
assertEquals(List.of("dismissed", "rejected"), calls);
}
}

5
DuneMenus/README.md Normal file
View file

@ -0,0 +1,5 @@
# DuneMenus
Custom Dune-themed menus for DuneRealms. No ChestCommands. One menu definition, rendered as a chest inventory (Java), a Floodgate form (Bedrock), or a full-screen provider (optional `FullscreenProvider` service).
Build JarvisConnector first, then run `gradle test jar` in this module (Java 21, Paper 1.21.8). Commands use `/dm [menu|reload]`. The plugin requires JarvisTranslator. The optional fullscreen service is a contract in the supplied module and requires a compatible implementation.
Exchange, House and mission actions use the existing J.A.R.V.I.S. service. Methods without an authoritative adapter remain unavailable. See docs/BACKEND.md for the original backend contract.

View file

@ -0,0 +1,23 @@
plugins { java }
group = "com.dunerealms"
version = "2.0.0"
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.opencollab.dev/main/")
}
dependencies {
compileOnly(files("../JarvisConnector/build/libs/jarvistranslator.jar"))
testImplementation(files("../JarvisConnector/build/libs/jarvistranslator.jar"))
testImplementation("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
testImplementation("org.junit.jupiter:junit-jupiter:5.11.4")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
compileOnly("org.geysermc.floodgate:api:2.2.5-SNAPSHOT") // same coordinates as DunerealmsGUI
}
java { toolchain.languageVersion.set(JavaLanguageVersion.of(21)) }
tasks.withType<JavaCompile> { options.encoding = "UTF-8" }
tasks.jar { archiveFileName.set("DuneMenus.jar") }
tasks.processResources { filesMatching("plugin.yml") { expand("version" to project.version) } }
tasks.test { useJUnitPlatform() }

17
DuneMenus/docs/BACKEND.md Normal file
View file

@ -0,0 +1,17 @@
# Backend contract (for the coder)
The GUI is design only. Everything it needs from the game lives in `Backend.java`; wire `JarvisBackend.java` by overriding methods one at a time. Un-overridden methods make the menu say "not connected yet". The development plugin loads the J.A.R.V.I.S. adapter.
Rules: money is minor units (1.00 DM = 100). Futures may complete on any thread. There are no confirm screens, so every mutating call must be safe against a double click (idempotent). Return `Result.no("reason")` for refusals; the text is shown to the player as is.
## ATM (one GUI, three tabs)
- Deposit cash: `atmCreateRia(player, amountMinor)` takes the cash (bills and coins amounts are chosen in the GUI, denominations in config.yml `atm.bills` / `atm.coins`), creates a NEW RIA ID worth that amount, returns `Issued(ok, message, riaId)`.
- Redeem: `atmLookup(player, riaId)` returns `Voucher(riaId, amountMinor, fromName)` or null if unknown/used. `atmRedeem(player, riaId, toBank)` pays out as cash (toBank=false) or credits the player's bank account (toBank=true). Must mark the ID used atomically.
- Withdraw cash: `bankWithdraw(player, amountMinor)` debits the bank account and gives cash.
The RIA ID is typed by the player in chat (next chat line is captured, "cancel" aborts) so it works on Java and Bedrock.
## Bank (Rihla Money Transfer)
`bankAccount`, `bankTransfers`, `bankSend(player, toUuid, amountMinor)` (creates a pending transfer, reserves amount + tax), `bankCancel(player, id)` (releases the reservation), `bankCollect(player, id)` (-1 = all). Tax: 1% of the amount up to and including 3,000 DM, 5% above, rounded up to the cent; the recipient receives the full amount. `Rihla.tax()` / `Rihla.total()` implement this for the previews; the backend stays the source of truth.
## Everything else
See the javadoc in `Backend.java`: balance, worlds/book (travel), listings/buy/sell/withdraw/collectPurchases (exchange), org/members/orgAction (clan, company), missions, spice, war, decisions, houses, refit.

View file

@ -0,0 +1 @@
rootProject.name = "DuneMenus"

View file

@ -0,0 +1,137 @@
package com.dunerealms.menus;
import com.dunerealms.jarvis.DunemarkDenomination;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
/**
* ONE ATM, three tabs, 5 rows, no PIN, no confirmations.
* Deposit : tap bills and coins, one click -> a new RIA ID is created and shown in the ID box.
* Redeem : type an RIA ID, then one click pays it out as Cash or To bank.
* Withdraw : tap bills and coins, one click takes the cash out of your own account.
*/
final class AtmMenu extends Menu {
enum Tab { DEPOSIT, REDEEM, WITHDRAW }
private static final int[] BILLS = {10, 11, 12, 19, 20};
private static final int[] COINS = {14, 15, 16};
private static final List<DunemarkDenomination> NOTES = List.of(DunemarkDenomination.NOTE_10, DunemarkDenomination.NOTE_20,
DunemarkDenomination.NOTE_50, DunemarkDenomination.NOTE_100, DunemarkDenomination.NOTE_500);
private static final List<DunemarkDenomination> COIN_VALUES = List.of(DunemarkDenomination.COIN_050,
DunemarkDenomination.COIN_1DM, DunemarkDenomination.COIN_2DM);
private Tab tab;
private final List<DunemarkDenomination> selected = new ArrayList<>();
private boolean recoveredDeposit;
private String issued; // RIA ID created by the last deposit
private String entered; // RIA ID typed on the Redeem tab
AtmMenu(DuneMenusPlugin plugin, Player p, Menu parent, Tab tab) { super(plugin, p, parent); this.tab = tab; }
String id() { return tab == Tab.WITHDRAW ? "withdraw" : "atm"; }
Skin skin() { return tab == Tab.REDEEM ? Skin.GOLD : Skin.TRAVEL; }
String title() { return "Rihla ATM"; }
String subtitle() { return switch (tab) {
case DEPOSIT -> "Put in cash. You get an RIA ID to keep or give away.";
case REDEEM -> "Got an RIA ID? Type it in and take the money as cash or to your bank.";
case WITHDRAW -> "Take cash out of your own bank account."; }; }
int rows() { return 5; }
private void tabButton(int slot, Material m, String label, Tab t) {
var item = Ui.item(m, (tab == t ? "<green><b>" : "<gray>") + label);
put(slot, tab == t ? Ui.glow(item) : item, c -> { tab = t; selected.clear(); redraw(); });
}
private void add(int slot, DunemarkDenomination denomination) {
put(slot, denomination.displayItem(), c -> {
if (selected.size() < 36) selected.add(denomination);
redraw();
});
}
void draw() {
backdrop(Material.BLACK_STAINED_GLASS_PANE);
for (int s : new int[]{3, 5, 6, 7, 8}) put(s, Ui.pane(Material.CYAN_STAINED_GLASS_PANE));
tabButton(0, Material.EMERALD, "Deposit cash", Tab.DEPOSIT);
tabButton(1, Material.NAME_TAG, "Redeem RIA ID", Tab.REDEEM);
tabButton(2, Material.GOLD_INGOT, "Withdraw cash", Tab.WITHDRAW);
back(36);
if (tab == Tab.REDEEM) drawRedeem(); else drawCash();
}
private void drawCash() {
long minor = selected.stream().mapToLong(DunemarkDenomination::faceMinor).sum();
boolean dep = tab == Tab.DEPOSIT;
String verb = dep ? "Deposit" : "Withdraw";
put(4, Ui.glow(Ui.item(Material.LIGHTNING_ROD, "<aqua><b>" + (minor == 0 ? "Choose bills and coins" : verb + " " + Ui.dm(minor)),
minor == 0 ? "<gray>Tap the bills and coins below" : "<gray>Ready")));
put(9, Ui.item(Material.GREEN_STAINED_GLASS_PANE, "<green><b>Bills"));
put(13, Ui.item(Material.YELLOW_STAINED_GLASS_PANE, "<gold><b>Coins"));
for (int i = 0; i < BILLS.length; i++) add(BILLS[i], NOTES.get(i));
for (int i = 0; i < COINS.length; i++) add(COINS[i], COIN_VALUES.get(i));
put(21, Ui.item(Material.RED_STAINED_GLASS_PANE, "<red><b>Clear"), c -> { selected.clear(); redraw(); });
put(24, minor == 0 ? Ui.item(Material.GRAY_DYE, "<gray>" + verb, "<dark_gray>Choose bills and coins first")
: Ui.glow(Ui.item(dep ? Material.EMERALD : Material.GOLD_INGOT, "<green><b>" + verb + " " + Ui.dm(minor),
dep ? "<gray>Creates a new RIA ID" : "<gray>From your bank account")),
c -> {
if (minor <= 0) return;
var pieces = List.copyOf(selected);
if (dep) load(backend().atmCreateRia(player, pieces), r -> {
say(new Backend.Result(r.ok(), r.message()));
if (r.ok()) { issued = r.riaId(); selected.clear(); }
redraw();
});
else load(backend().bankWithdraw(player, pieces), r -> {
say(r);
if (r.ok()) selected.clear();
redraw();
});
});
// framed ID box
for (int s : new int[]{28, 30}) put(s, Ui.pane(Material.YELLOW_STAINED_GLASS_PANE));
if (dep) {
drawIssuedVoucher();
if (!recoveredDeposit) load(backend().atmRecentDeposit(player), voucher -> {
recoveredDeposit = true;
issued = voucher.isEmpty() ? null : voucher;
drawIssuedVoucher();
});
} else {
put(29, Ui.item(Material.NAME_TAG, "<gold><b>Rihla reference", "<gray>Loading…"));
load(backend().bankAccount(player), a -> put(29, Ui.item(Material.NAME_TAG, "<gold><b>Rihla reference",
"<white>" + a.accountNo(), "<gray>Postbank available: <white>" + (a.postbankAvailableMinor()==null?"Unavailable":Ui.dm(a.postbankAvailableMinor())))));
}
}
private void drawIssuedVoucher() {
put(29, issued == null ? Ui.item(Material.NAME_TAG, "<gold><b>Your new RIA ID", "<dark_gray>Appears here after you deposit")
: Ui.glow(Ui.item(Material.NAME_TAG, "<gold><b>Your new RIA ID", "<white>" + issued, "<gray>Give it to anyone to collect the money",
"<yellow>Click to show in chat")),
c -> { if (issued != null) player.sendMessage(Ui.text("<gold>RIA ID: <click:copy_to_clipboard:'" + issued + "'><white><u>" + issued + "</u></click>")); });
}
private void drawRedeem() {
put(4, Ui.glow(Ui.item(Material.LIGHTNING_ROD, "<aqua><b>Redeem an RIA ID", "<gray>1. Type the ID", "<gray>2. Pick Cash or To bank")));
put(13, Ui.item(Material.WRITABLE_BOOK, entered == null ? "<yellow><b>Type RIA ID" : "<yellow><b>Change RIA ID",
"<gray>Click, then type it in chat"), c -> {
end();
ChatPrompt.ask(player, "<gold>Type the RIA ID in chat:", text -> { if (text != null && text.matches("RIA-[A-F0-9]{32}")) entered = text; open(); });
});
for (int s : new int[]{28, 30}) put(s, Ui.pane(Material.YELLOW_STAINED_GLASS_PANE));
put(29, Ui.item(Material.NAME_TAG, "<gold><b>RIA ID", entered == null ? "<dark_gray>Nothing entered yet" : "<white>" + entered));
put(24, Ui.item(Material.GRAY_DYE, "<gray>Take as cash", "<dark_gray>Enter an RIA ID first"));
put(26, Ui.item(Material.GRAY_DYE, "<gray>Send to my bank", "<dark_gray>Enter an RIA ID first"));
if (entered == null) return;
final String id = entered;
load(backend().atmLookup(player, id), v -> {
if (v == null) { put(22, Ui.item(Material.BARRIER, "<red>RIA ID not found")); return; }
put(22, Ui.glow(Ui.item(Material.GOLD_BLOCK, "<gold><b>" + Ui.dm(v.amountMinor()), "<gray>From: <white>" + v.fromName())));
put(24, Ui.glow(Ui.item(Material.GOLD_INGOT, "<green><b>Take as cash", "<gray>Bills and coins in your inventory")),
c -> load(backend().atmRedeem(player, v, false), r -> { say(r); if (r.ok()) entered = null; redraw(); }));
put(26, Ui.glow(Ui.item(Material.ENDER_CHEST, "<aqua><b>Send to my bank", "<gray>Credited to your account")),
c -> load(backend().atmRedeem(player, v, true), r -> { say(r); if (r.ok()) entered = null; redraw(); }));
});
}
}

Some files were not shown because too many files have changed in this diff Show more