Preserve JARVIS menus while porting gameplay, Citizens NPCs and plugin-only CI
This commit is contained in:
parent
a16b7adc1d
commit
dbf4bb25ff
5897 changed files with 2251 additions and 196035 deletions
|
|
@ -1,7 +0,0 @@
|
||||||
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'/);
|
|
||||||
});
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
name: "🗑️ Clean old CI artifacts"
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
dry_run:
|
|
||||||
description: "Preview only (untick to delete eligible artifacts)"
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: manual-ci-artifact-cleanup
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
cleanup:
|
|
||||||
if: github.ref == 'refs/heads/main'
|
|
||||||
runs-on: dune-ci
|
|
||||||
timeout-minutes: 5
|
|
||||||
steps:
|
|
||||||
- name: Checkout cleanup script
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
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 checkout --detach FETCH_HEAD
|
|
||||||
- name: Install Node 22
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '22'
|
|
||||||
- name: Preview or clean old website artifacts
|
|
||||||
env:
|
|
||||||
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
DRY_RUN: ${{ inputs.dry_run }}
|
|
||||||
run: node website/scripts/manual-ci-cleanup.mjs
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
name: DuneRealms Kit Delivery CI
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main, dev/kit-atelier-v3]
|
|
||||||
paths:
|
|
||||||
- 'network/server-control/kit*'
|
|
||||||
- 'network/server-control/player_kits.py'
|
|
||||||
- '.forgejo/workflows/kit-delivery.yml'
|
|
||||||
workflow_dispatch:
|
|
||||||
jobs:
|
|
||||||
kits:
|
|
||||||
runs-on: dune-ci
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
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 checkout --detach FETCH_HEAD
|
|
||||||
- name: Verify kit delivery bridge
|
|
||||||
run: python3 -m unittest discover -s network/server-control -p 'test_*.py' -v
|
|
||||||
|
|
@ -8,6 +8,10 @@ on:
|
||||||
- 'Dune*/**'
|
- 'Dune*/**'
|
||||||
- 'JarvisConnector/**'
|
- 'JarvisConnector/**'
|
||||||
- 'gui-common/**'
|
- 'gui-common/**'
|
||||||
|
- 'citizens-common/**'
|
||||||
|
- 'network/resource-pack/shared/**'
|
||||||
|
- 'network/content-assets/planet-artwork/profiles.json'
|
||||||
|
- 'tools/*gameplay*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
plugins:
|
plugins:
|
||||||
|
|
@ -20,7 +24,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
git init .
|
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/fallback.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/unimatrix/plugins.git "$GITHUB_SHA"
|
||||||
git checkout --detach FETCH_HEAD
|
git checkout --detach FETCH_HEAD
|
||||||
- uses: actions/setup-java@v4
|
- uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
|
|
@ -46,6 +50,13 @@ jobs:
|
||||||
done
|
done
|
||||||
printf '%s\n' "$(git rev-parse HEAD)" > plugin-artifacts/SOURCE_COMMIT
|
printf '%s\n' "$(git rev-parse HEAD)" > plugin-artifacts/SOURCE_COMMIT
|
||||||
(cd plugin-artifacts && sha256sum -- *.jar SOURCE_COMMIT > SHA256SUMS)
|
(cd plugin-artifacts && sha256sum -- *.jar SOURCE_COMMIT > SHA256SUMS)
|
||||||
|
- name: Validate gameplay assets and build pack with original GUI
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
python3 tools/test_gameplay_resourcepack.py -v
|
||||||
|
python3 tools/build-gameplay-resourcepack.py --from-gui-config DuneRealmsGUI/src/main/resources/gui-pack.yml --output "plugin-artifacts/DuneRealms-Gameplay-${GITHUB_SHA}.zip"
|
||||||
|
(cd plugin-artifacts && sha256sum -- *.jar *.zip *.manifest.json SOURCE_COMMIT > SHA256SUMS)
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: DuneRealms-Plugins
|
name: DuneRealms-Plugins
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ on:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths:
|
paths:
|
||||||
- 'DuneRealmsGUI/**'
|
- 'DuneRealmsGUI/**'
|
||||||
|
- 'network/resource-pack/shared/**'
|
||||||
|
- 'tools/*gameplay*'
|
||||||
- 'tools/build-resourcepack-repair.py'
|
- 'tools/build-resourcepack-repair.py'
|
||||||
- 'tools/test_resourcepack_repair.py'
|
- 'tools/test_resourcepack_repair.py'
|
||||||
- 'tools/build-arrakis-fauna-pack.mjs'
|
- 'tools/build-arrakis-fauna-pack.mjs'
|
||||||
|
|
@ -24,7 +26,7 @@ jobs:
|
||||||
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
git init .
|
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/unimatrix/plugins.git "$GITHUB_SHA"
|
||||||
git checkout --detach FETCH_HEAD
|
git checkout --detach FETCH_HEAD
|
||||||
- name: Build immutable repair archives and verify pinned inputs
|
- name: Build immutable repair archives and verify pinned inputs
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
@ -36,6 +38,10 @@ jobs:
|
||||||
python3 tools/build-resourcepack-repair.py resourcepack-baselines/DuneRealms-Network-Artwork-v3.zip resourcepack-baselines/DuneRealms-Materials-arrakis-v4.zip resourcepack-output
|
python3 tools/build-resourcepack-repair.py resourcepack-baselines/DuneRealms-Network-Artwork-v3.zip resourcepack-baselines/DuneRealms-Materials-arrakis-v4.zip resourcepack-output
|
||||||
DUNE_FAUNA_BASELINE_DIR="$PWD/resourcepack-output" python3 tools/test_fauna_pack_update.py -v
|
DUNE_FAUNA_BASELINE_DIR="$PWD/resourcepack-output" python3 tools/test_fauna_pack_update.py -v
|
||||||
python3 tools/build-fauna-pack-update.py resourcepack-output resourcepack-output/fauna-preview
|
python3 tools/build-fauna-pack-update.py resourcepack-output resourcepack-output/fauna-preview
|
||||||
|
- name: Verify item cards and preserve the working GUI pack
|
||||||
|
run: |
|
||||||
|
python3 tools/test_gameplay_resourcepack.py -v
|
||||||
|
python3 tools/build-gameplay-resourcepack.py --from-gui-config DuneRealmsGUI/src/main/resources/gui-pack.yml --output resourcepack-output/DuneRealms-Gameplay.zip
|
||||||
- name: Install Java 21
|
- name: Install Java 21
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
||||||
name: DuneRealms Web CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- 'website/**'
|
|
||||||
- '.forgejo/workflows/web-deploy.yml'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
web:
|
|
||||||
runs-on: dune-ci
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
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/fallback.git "$GITHUB_SHA"
|
|
||||||
git checkout --detach FETCH_HEAD
|
|
||||||
|
|
||||||
- name: Install Node 22
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '22'
|
|
||||||
|
|
||||||
- name: Prepare publication comparison
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
BEFORE=$(node -e 'const fs=require("fs");const p=process.env.GITHUB_EVENT_PATH;const e=p&&fs.existsSync(p)?JSON.parse(fs.readFileSync(p)):{};process.stdout.write(e.before||"");')
|
|
||||||
if [[ ! "$BEFORE" =~ ^[0-9a-f]{40}$ || "$BEFORE" =~ ^0+$ ]]; then
|
|
||||||
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --deepen=1 https://www.dunerealms.com/git/unimatrix/fallback.git "$GITHUB_SHA"
|
|
||||||
BEFORE=$(git rev-parse --verify HEAD^ 2>/dev/null || git hash-object -w -t tree /dev/null)
|
|
||||||
else
|
|
||||||
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/fallback.git "$BEFORE"
|
|
||||||
fi
|
|
||||||
node website/scripts/publication-changes.mjs "$BEFORE" "$GITHUB_SHA"
|
|
||||||
|
|
||||||
- name: Verify deployment policy
|
|
||||||
run: |
|
|
||||||
node --test .forgejo/tests/web-deploy.test.mjs
|
|
||||||
python3 -m unittest discover -s website/ops -p 'test_*.py'
|
|
||||||
|
|
||||||
- name: Build and test website
|
|
||||||
working-directory: website
|
|
||||||
run: |
|
|
||||||
corepack enable
|
|
||||||
corepack pnpm install --frozen-lockfile
|
|
||||||
corepack pnpm build
|
|
||||||
corepack pnpm test
|
|
||||||
node --test --test-concurrency=1 ../tools/tests/*.test.mjs
|
|
||||||
|
|
||||||
- name: Upload website build
|
|
||||||
if: github.ref == 'refs/heads/main'
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: DuneRealms-Website
|
|
||||||
path: website/dist/
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
- name: Trigger deployment after successful CI
|
|
||||||
if: github.ref == 'refs/heads/main'
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
DEPLOY_KEY: ${{ secrets.DUNEREALMS_DEPLOY_KEY }}
|
|
||||||
run: |
|
|
||||||
install -m 700 -d ~/.ssh
|
|
||||||
printf '%s\n' "$DEPLOY_KEY" > ~/.ssh/deploy_key
|
|
||||||
chmod 600 ~/.ssh/deploy_key
|
|
||||||
trap 'rm -f ~/.ssh/deploy_key' EXIT
|
|
||||||
printf '%s\n' '91.107.196.242 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC8x/XocsIz41fWHGty0DbZhSvafSQFt9jaHHgzdr55W root@ubuntu-4gb-fsn1-1' >> ~/.ssh/known_hosts
|
|
||||||
ssh -p 22 -i ~/.ssh/deploy_key -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=yes dunedeploy@91.107.196.242 "$GITHUB_SHA"
|
|
||||||
rm -f ~/.ssh/deploy_key
|
|
||||||
|
|
||||||
221
.github/workflows/build.yml
vendored
221
.github/workflows/build.yml
vendored
|
|
@ -1,221 +0,0 @@
|
||||||
|
|
||||||
name: Build DuneCore, DuneNPC, DuneEss, and DuneTerrain
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches: [main, "feature/native-gui-1.21.8"]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-website:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: website
|
|
||||||
steps:
|
|
||||||
- name: Checkout source
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '22'
|
|
||||||
- name: Install website server dependencies
|
|
||||||
run: npm install --omit=dev --no-audit --no-fund
|
|
||||||
- name: Build the illustrated website and API
|
|
||||||
run: node scripts/build.mjs
|
|
||||||
- name: Test feeds and compiled pages
|
|
||||||
run: node --test tests/*.test.mjs
|
|
||||||
- name: Test inventory ownership and private market bridge
|
|
||||||
run: node --test ../control-panel-inventory/tests/*.test.mjs
|
|
||||||
- name: Upload website build
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: Project-Dune-Website
|
|
||||||
path: website/dist/
|
|
||||||
include-hidden-files: true
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
build-core:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: DuneRealms-minecraft-only
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout source
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Java 21
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: temurin
|
|
||||||
java-version: '21'
|
|
||||||
|
|
||||||
- name: Set up Gradle
|
|
||||||
uses: gradle/actions/setup-gradle@v4
|
|
||||||
with:
|
|
||||||
gradle-version: '8.14'
|
|
||||||
|
|
||||||
- name: Compile DuneCore
|
|
||||||
run: gradle clean build
|
|
||||||
|
|
||||||
- name: Upload compiled JAR
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: DuneCore-Plugin
|
|
||||||
path: DuneRealms-minecraft-only/build/libs/*.jar
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
build-terrain:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: DuneTerrain
|
|
||||||
steps:
|
|
||||||
- name: Checkout source
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up Java 21
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: temurin
|
|
||||||
java-version: '21'
|
|
||||||
- name: Set up Gradle
|
|
||||||
uses: gradle/actions/setup-gradle@v4
|
|
||||||
with:
|
|
||||||
gradle-version: '8.14'
|
|
||||||
- name: Compile DuneTerrain
|
|
||||||
run: gradle clean build
|
|
||||||
- name: Upload compiled JAR
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: DuneTerrain-Plugin
|
|
||||||
path: DuneTerrain/build/libs/*.jar
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
build-ess:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: DuneEss
|
|
||||||
steps:
|
|
||||||
- name: Checkout source
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up Java 21
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: temurin
|
|
||||||
java-version: '21'
|
|
||||||
- name: Set up Gradle
|
|
||||||
uses: gradle/actions/setup-gradle@v4
|
|
||||||
with:
|
|
||||||
gradle-version: '8.14'
|
|
||||||
- name: Compile DuneEss
|
|
||||||
run: gradle clean build
|
|
||||||
- name: Upload compiled JAR
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: DuneEss-Plugin
|
|
||||||
path: DuneEss/build/libs/*.jar
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
build-npc:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: DuneNPC
|
|
||||||
steps:
|
|
||||||
- name: Checkout source
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up Java 21
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: temurin
|
|
||||||
java-version: '21'
|
|
||||||
- name: Set up Gradle
|
|
||||||
uses: gradle/actions/setup-gradle@v4
|
|
||||||
with:
|
|
||||||
gradle-version: '8.14'
|
|
||||||
- name: Compile and test DuneNPC
|
|
||||||
run: gradle clean build
|
|
||||||
- name: Upload compiled JAR
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: DuneNPC-Plugin
|
|
||||||
path: DuneNPC/build/libs/*.jar
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
build-lobby:
|
|
||||||
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 clean build
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: DuneLobby-Plugin
|
|
||||||
path: DuneLobby/build/libs/*.jar
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
package-server:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build-core, build-ess, build-terrain, build-npc, build-lobby]
|
|
||||||
steps:
|
|
||||||
- name: Checkout source
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Download all plugin JARs
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
pattern: Dune*-Plugin
|
|
||||||
path: DuneRealms-Server-Package
|
|
||||||
merge-multiple: true
|
|
||||||
- name: Download verified crossplay plugins
|
|
||||||
run: python3 tools/download-crossplay.py DuneRealms-Server-Package/crossplay
|
|
||||||
- name: Add resource pack and install instructions
|
|
||||||
run: |
|
|
||||||
curl --fail --location --silent --show-error \
|
|
||||||
https://github.com/Foulest/Vault/releases/download/2.5.0/Vault-2.5.0.jar \
|
|
||||||
--output DuneRealms-Server-Package/Vault-2.5.0.jar
|
|
||||||
echo "3efb1c893d35807c0f3945068858a96af0f131020eee37545bdddb330044b2d9 DuneRealms-Server-Package/Vault-2.5.0.jar" | sha256sum --check --strict
|
|
||||||
curl --fail --location --silent --show-error \
|
|
||||||
https://raw.githubusercontent.com/Foulest/Vault/2.5.0/LICENSE \
|
|
||||||
--output DuneRealms-Server-Package/Vault-LICENSE.txt
|
|
||||||
cp DuneResourcePack.zip DuneRealms-Server-Package/
|
|
||||||
cp docs/Dune-User-Manual.pdf DuneRealms-Server-Package/
|
|
||||||
cp docs/Dune-Complete-Illustrated-Manual.pdf DuneRealms-Server-Package/
|
|
||||||
cp docs/posters/*.png DuneRealms-Server-Package/
|
|
||||||
cp docs/Native-GUI.md DuneRealms-Server-Package/Native-GUI.md
|
|
||||||
cp README.md DuneRealms-Server-Package/Project-README.md
|
|
||||||
cp website/DISCORD-FEEDS.md DuneRealms-Server-Package/DiscordSRV-Website-Setup.md
|
|
||||||
cat > DuneRealms-Server-Package/README.txt <<'EOF'
|
|
||||||
DuneRealms Paper server package
|
|
||||||
|
|
||||||
Contents: Vault 2.5.0, all five Dune plugins, and verified Geyser, Floodgate, ViaVersion JARs.
|
|
||||||
See Native-GUI.md for platform-specific plugin placement.
|
|
||||||
The illustrated user manual and Project-README.md are included for players and administrators.
|
|
||||||
|
|
||||||
Install the applicable plugin JARs in the Paper server's plugins/ folder and restart the server.
|
|
||||||
Install the included resource pack on vanilla or Fabric 1.21.4 clients for sandworm, haunted Fremen, and spice textures.
|
|
||||||
On Fabric, put the ZIP in .minecraft/resourcepacks and enable it in Options > Resource Packs; do not put it in mods/.
|
|
||||||
DuneEss provides the Solaris economy through the included Vault API plugin.
|
|
||||||
Vault 2.5.0 is the GPL-3.0 licensed Foulest/MilkBowl Vault project; its license is included here.
|
|
||||||
Its source is available at https://github.com/Foulest/Vault/tree/2.5.0.
|
|
||||||
|
|
||||||
Compatible GUI build target: Paper 1.21.8, Java 21.
|
|
||||||
See https://github.com/thomasv6545-glitch/MC for setup and configuration details.
|
|
||||||
EOF
|
|
||||||
- name: ZIP every server plugin JAR together
|
|
||||||
run: zip -r DuneRealms-All-Server-Jars.zip DuneRealms-Server-Package
|
|
||||||
- name: Upload one downloadable server package
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: DuneRealms-Server-Package
|
|
||||||
path: DuneRealms-All-Server-Jars.zip
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 90
|
|
||||||
28
.github/workflows/lobby.yml
vendored
28
.github/workflows/lobby.yml
vendored
|
|
@ -1,28 +0,0 @@
|
||||||
name: Build Guild Lobby companion
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches: [main, beta]
|
|
||||||
paths: ['DuneLobby/**', 'worlds/**', '.github/workflows/lobby.yml', 'gui-common/**']
|
|
||||||
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.1.0.zip
|
|
||||||
DuneLobby/README.md
|
|
||||||
DuneLobby/VALIDATION.md
|
|
||||||
if-no-files-found: error
|
|
||||||
25
.github/workflows/network-preflight.yml
vendored
25
.github/workflows/network-preflight.yml
vendored
|
|
@ -1,25 +0,0 @@
|
||||||
name: Network configuration preflight
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'network/**'
|
|
||||||
- 'DuneTerrain/src/main/resources/config.yml'
|
|
||||||
- '.github/workflows/network-preflight.yml'
|
|
||||||
workflow_dispatch:
|
|
||||||
jobs:
|
|
||||||
validate:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.12'
|
|
||||||
- name: Check inventory and build world config ZIPs
|
|
||||||
run: python3 network/preflight.py --check-worlds
|
|
||||||
- name: Simulate 1000 chunks of planetary ore attempts
|
|
||||||
run: python3 network/simulate-ores.py
|
|
||||||
- name: Upload world configuration packages
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: dune-world-configs
|
|
||||||
path: network/generated-worlds/*-world-config.zip
|
|
||||||
52
.github/workflows/network.yml
vendored
52
.github/workflows/network.yml
vendored
|
|
@ -1,52 +0,0 @@
|
||||||
name: Package DuneRealms Velocity Network
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches: [main, "feature/native-gui-1.21.8"]
|
|
||||||
paths:
|
|
||||||
- 'network/**'
|
|
||||||
- 'gui-common/**'
|
|
||||||
- 'tools/**'
|
|
||||||
- 'DuneLobby/**'
|
|
||||||
- 'DuneTerrain/**'
|
|
||||||
- 'DuneEss/**'
|
|
||||||
- 'DuneNPC/**'
|
|
||||||
- 'DuneRealms-minecraft-only/**'
|
|
||||||
- '.github/workflows/network.yml'
|
|
||||||
jobs:
|
|
||||||
package:
|
|
||||||
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'
|
|
||||||
- name: Build plugins
|
|
||||||
run: |
|
|
||||||
set -e
|
|
||||||
mkdir -p built-plugins
|
|
||||||
for project in DuneRealms-minecraft-only DuneTerrain DuneNPC DuneEss DuneLobby; do
|
|
||||||
(cd "$project" && gradle clean build)
|
|
||||||
done
|
|
||||||
cp DuneRealms-minecraft-only/build/libs/*.jar built-plugins/DuneCore.jar
|
|
||||||
cp DuneTerrain/build/libs/*.jar built-plugins/DuneTerrain.jar
|
|
||||||
cp DuneNPC/build/libs/*.jar built-plugins/DuneNPC.jar
|
|
||||||
cp DuneEss/build/libs/*.jar built-plugins/DuneRealms-Essentials.jar
|
|
||||||
cp DuneLobby/build/libs/*.jar built-plugins/DuneLobby.jar
|
|
||||||
- name: Download verified crossplay plugins
|
|
||||||
run: |
|
|
||||||
python3 tools/download-crossplay.py built-crossplay
|
|
||||||
curl --fail --location --silent --show-error https://github.com/Foulest/Vault/releases/download/2.5.0/Vault-2.5.0.jar --output built-crossplay/universal/Vault-2.5.0.jar
|
|
||||||
echo "3efb1c893d35807c0f3945068858a96af0f131020eee37545bdddb330044b2d9 built-crossplay/universal/Vault-2.5.0.jar" | sha256sum --check --strict
|
|
||||||
curl --fail --location --silent --show-error https://raw.githubusercontent.com/Foulest/Vault/2.5.0/LICENSE --output built-crossplay/Vault-LICENSE.txt
|
|
||||||
- name: Package six servers and Velocity config
|
|
||||||
run: python3 network/package.py
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: DuneRealms-Velocity-Network
|
|
||||||
path: DuneRealms-Velocity-Network.zip
|
|
||||||
if-no-files-found: error
|
|
||||||
114
AGENTS.md
114
AGENTS.md
|
|
@ -1,105 +1,11 @@
|
||||||
# DuneRealms default working instructions
|
# DuneRealms plugin development
|
||||||
|
|
||||||
These are the user's default preferences for future DuneRealms work. Apply them unless the user changes them.
|
- Production plugin source is `unimatrix/plugins:main`. Website source is `unimatrix/web`; do not edit it from this repository.
|
||||||
|
- Use local Git for source edits and commits, and Composio for DuneGit PRs and CI. No SSH without explicit user authorization.
|
||||||
## Production release rules
|
- Reuse the current open PR. Never push directly to main or merge/deploy without owner authorization.
|
||||||
|
- Keep the working JARVIS backend and permissions. The supplied DuneMenus ZIP defines presentation, not replacement backend logic. Keep DuneNPC.jar.
|
||||||
- `unimatrix/MC:main` is the production source. Keep the website and the currently deployed Arrakis plugin source together. `dev/MC` is the development fork for edits, commits, builds and CI. Preserve uncommitted work when reconciling checkouts.
|
- Do not add ChestCommands, duplicate menus or confirmation screens.
|
||||||
- Keep at most one open pull request per repository. Reuse it for follow-up commits. Direct pushes to main are prohibited. Merge completed changes only after successful CI and explicit owner authorization.
|
- Keep this repository limited to plugins, shared source, resources, tests and required build/CI inputs.
|
||||||
- Every plugin change goes through a build from a recorded Git commit. Record each JAR filename, plugin version and SHA-256 in the release manifest. Roll out the exact tested artifacts and verify their hashes against the installed JARs.
|
- Record exact source commit, JAR filenames/versions and SHA-256 hashes. Test and build the recorded revision; distinguish artifacts, merge and actual verified deployment.
|
||||||
- Treat any mismatch between the production source, the build manifest and the installed plugins as release drift. Reconcile the source and retest before a replacement rollout. Avoid manual edits or class overlays on live JARs.
|
- Never commit credentials or print tokens/private keys. No real financial transactions or world regeneration.
|
||||||
|
- Preserve unrelated local work and earned player progression. Treat expected migration of explicitly requested NPC types separately from deleting gameplay data.
|
||||||
## Tools and access
|
|
||||||
|
|
||||||
- Prefer the connected Composio Gitea/Forgejo integration for DuneGit repository reads, pull requests, workflow dispatch, CI status, and deployment actions.
|
|
||||||
- Discover the actual tools and schemas before use. Do not assume that a GitHub tool targets DuneGit.
|
|
||||||
- Use local Git for local edits, diffs, commits, and efficient pushes of tested local changes. This does not require SSH access to the server.
|
|
||||||
- Use direct SSH only for server operations that repository/CI tools cannot perform. Keep SSH use minimal. Do not require Gateway when it is unavailable or its quota is exhausted.
|
|
||||||
- Never save passwords, private keys, tokens, or credential-bearing URLs in instructions, commits, logs, or PR descriptions.
|
|
||||||
|
|
||||||
## Small batches through CI
|
|
||||||
|
|
||||||
- Implement, check, commit, and publish small coherent batches as work progresses. Do not hold all completed work until the entire feature is finished.
|
|
||||||
- Reuse existing infrastructure, permissions, audit records, and payment/voting mechanisms wherever possible.
|
|
||||||
- Run checks appropriate to each batch. Fix failures caused by the change before publishing. Report any existing unrelated failures accurately.
|
|
||||||
- Push changes to the current development branch. Update the existing pull request until the agreed scope is complete.
|
|
||||||
- Deploy verified batches through the established website CI and deployment pipeline. A workflow dispatch being accepted, or an artifact being uploaded, does not establish that production is updated.
|
|
||||||
- Follow CI and deployment through completion, then verify the live release and affected behavior before claiming it is live.
|
|
||||||
- If a dispatch reports an error after HTTP 204, or a write times out, inspect the resulting run/remote state before retrying. Avoid duplicate writes or deployments.
|
|
||||||
|
|
||||||
## Protect existing progress
|
|
||||||
|
|
||||||
- Inspect the working tree and remote branch heads before changing branches or publishing. Preserve unrelated edits and work in progress.
|
|
||||||
- Explicitly fetch the intended remote branch ref into its tracking ref when needed, and verify it matches the remote head. Do not assume a plain fetch refreshed an old tracking branch.
|
|
||||||
- Never restore an old release, force-push, hard-reset, replace live files from an old backup, or resolve conflicts by discarding newer work merely to make deployment pass.
|
|
||||||
- Stop and diagnose unexpected ancestry, missing files, or modify/delete conflicts. Preserve the current state; do not force a merge or push.
|
|
||||||
- Keep backups outside the source tree and do not copy credentials into ordinary build artifacts.
|
|
||||||
- Do not run broad cleanup, destructive migrations, or financial transactions unless the user has authorized the actual action.
|
|
||||||
|
|
||||||
## Collaboration and product behavior
|
|
||||||
|
|
||||||
- Continue authorized work without repeated permission questions or handoffs. Do not switch to Work mode.
|
|
||||||
- Give concise progress updates describing results, blockers, and the next useful step.
|
|
||||||
- Preserve existing working voting and banking behavior. Personal voting rights are absolute; organisation voting changes must not transfer personal votes.
|
|
||||||
- Place new features in the existing navigation structure when an item already exists. Avoid duplicate menus.
|
|
||||||
- Use the established CP design, readable colors, gold framing, and appropriate original Dune/Minecraft-inspired artwork. Company CP uses the Vaerkring/Spacing Guild-inspired palette.
|
|
||||||
- Clearly mark unfinished features as coming soon. Do not display invented records, offers, payments, or completed actions.
|
|
||||||
|
|
||||||
## J.A.R.V.I.S. data-operation workflow (2026-11-18)
|
|
||||||
|
|
||||||
- Use Git, reviewed batches and CI for changes to files, code, schemas and action implementations.
|
|
||||||
- Perform supported user/domain data changes through validated J.A.R.V.I.S. actions and instruments. Do not use ad hoc SQL/manual database editing as an operational shortcut.
|
|
||||||
- Special dev keys are server/CLI-only overrides bound to an exact action manifest, environment, authorised developer identity and short validity. Never expose their issuance, secrets or execution through website routes, dropdowns or web APIs, including Big 4 accounts.
|
|
||||||
- An ordinary code is not authority. Revalidate identity, action scope and domain conditions on execution. Keep irreversible actions explicit in the manifest.
|
|
||||||
- Record issuance ID/hash, actor, manifest hash, each result, failures and completion; never log a secret key. Enforce once-only execution and safe retries/rollback.
|
|
||||||
- Existing supported data actions require no PR/deployment per execution. New action logic still requires tests, Git and publication.
|
|
||||||
- Never call a verifier-only test a successful live operation. Report local, simulated, staged and executed states accurately.
|
|
||||||
- Seasonal changes use an explicit versioned dev batch. Preserve/reset decisions are per-season configuration, not automatic consequences of every deploy.
|
|
||||||
- Honour the approved reset exclusions: official/protected organisations and the owner's clan/company rosters; no broader reset unless explicitly requested. No Minecraft code or deployment in this web/backend batch.
|
|
||||||
|
|
||||||
Current priority: implement and test the server-only dev-key executor, starting with the authorised clan-reset batch. Keep special dev tools outside the website package.
|
|
||||||
|
|
||||||
## Masterkey reuse before new code
|
|
||||||
|
|
||||||
- Before implementing a page or action, read `website/control-panel/public/jarvis-master-keys.mjs` and its existing domain adapter. Reuse an existing action rather than duplicating its flow.
|
|
||||||
- Register every new key-backed action in that catalogue in the same change, with version, typed fields, domain rules, authority and execution status. Never claim a catalogue entry is executable before its adapter is connected.
|
|
||||||
- The website generator cannot generate or modify developer keys, including for owner/Big 4 accounts. This is a fixed server boundary, not an assignable permission. An issued devkey can only be used through its separately permitted execution route. Developer issuance remains outside the website package.
|
|
||||||
|
|
||||||
## Chat-requested keys must update web keygen
|
|
||||||
|
|
||||||
- Whenever the user requests a key here in the development chat, find its mastertemplate and execution flow first. If absent, add the versioned template, typed fields and validated domain adapter, then update/publish the web generator as part of fulfilling that request. Reuse existing flows when present.
|
|
||||||
- This trigger is a chat request, not website-submitted arbitrary flow code. The website cannot create new execution logic from user input.
|
|
||||||
- Developer keys remain an absolute exception to web issuance: keygen must never generate or modify them, including for owner/Big 4. Devticket requests may collect a requested action and approval; developer issuance remains in the separately authorised development flow.
|
|
||||||
|
|
||||||
## Developer keys are the last resort
|
|
||||||
|
|
||||||
- For every requested operation, first search the masterkey catalogue and existing domain actions for a normal scoped key that achieves the same authorised result. Prefer it over a developer key.
|
|
||||||
- Do not broaden an ordinary key, bypass its permission checks, or disguise developer capabilities as a normal template to avoid this boundary. If no suitable ordinary flow exists, a separately approved developer ticket/key may be considered through the developer-only route.
|
|
||||||
|
|
||||||
## User-requested batch tracking (24 November 2026)
|
|
||||||
|
|
||||||
- Before starting each implementation batch, create one Development task ticket through the existing validated private support workflow. The user explicitly authorises automatic approval of these batch tickets.
|
|
||||||
- Group at least three genuine user requests in a batch; do not count individual technical edits as separate requests. War is one request, POL missions and POL decisions are the other two requests in the current batch.
|
|
||||||
- Include the scope checklist, verification plan, PR/commit and actual live-release evidence in that ticket. Update its progress and complete it only when its stated scope is actually live and verified.
|
|
||||||
- Placeholder pages must be explicitly marked as previews and include all appropriate DuneRealms artwork. Preserve working actions while the remaining consumers are built.
|
|
||||||
|
|
||||||
## Latest owner direction: portal and control-panel redesign (24 November 2026)
|
|
||||||
|
|
||||||
- The owner said “negeer tickets”: skip ticket creation; it must not block work.
|
|
||||||
- Current priority is the public portal preview before further CP redesign. The owner explicitly wants to keep the current site if unsatisfied: do not replace the live homepage before design acceptance.
|
|
||||||
- Use the supplied green/gold portal image as inspiration, not an immutable layout. Preserve the existing logo, seals, awards and avatars. Other layouts, menus and artwork may be redesigned, including the CPs.
|
|
||||||
- Reduce the number of control panels and unify their design, but do not cram everything into one panel. Personal services, organisation management and staff need distinct, understandable workspaces.
|
|
||||||
- The POL backend can retain its existing service contracts independently of presentation changes. The tested political-war backend batch remains on PR 563, separate from this design preview.
|
|
||||||
- Existing hostnames are sufficient for this preview. Discuss a new hostname only if implementation actually needs it.
|
|
||||||
|
|
||||||
## Accepted full-site scope (24 November 2026)
|
|
||||||
|
|
||||||
- Portal design accepted. Apply the approved shared style throughout the site, Exchange and control panels, then finish the backend.
|
|
||||||
- User comfort takes priority: short navigation, readable labels, accessible mobile controls and clear back paths.
|
|
||||||
- Consolidate clan/company/POL presentation in an organisation workspace; personal and staff remain separate. Preserve all domain permissions and deep links.
|
|
||||||
- Latest bans and appeals belong on a separate Community page. Keep original logos, seals, awards, avatars and the approved travel picker.
|
|
||||||
|
|
||||||
## Backend integration after design acceptance
|
|
||||||
|
|
||||||
- Preserve the accepted site redesign. Continue the authorised war, POL missions and POL decisions through their existing service contracts.
|
|
||||||
- Ticket creation remains skipped by the explicit owner override.
|
|
||||||
|
|
@ -27,7 +27,7 @@ final class EssentialsBasics implements CommandExecutor, TabCompleter, Listener
|
||||||
}
|
}
|
||||||
void register() {
|
void register() {
|
||||||
homeTravel=new PersonalHomeTravel(plugin);
|
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));
|
PluginCommand command=Objects.requireNonNull(plugin.getCommand(name));
|
||||||
command.setExecutor(this); command.setTabCompleter(this);
|
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.");
|
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;
|
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 String key(Player p,String name) { return p.getUniqueId()+"."+name; }
|
||||||
private Set<String> names(Player p) {
|
private Set<String> names(Player p) {
|
||||||
var section=homes.getConfigurationSection(p.getUniqueId().toString());
|
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 {
|
private void save() throws IOException {
|
||||||
Path target=file.toPath(), temp=target.resolveSibling("homes.yml.tmp");
|
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 "essentials" -> menu(p);
|
||||||
case "homes" -> homeMenu(p);
|
case "homes" -> homeMenu(p);
|
||||||
case "sethome" -> {
|
case "sethome" -> {
|
||||||
String name=homeName(args), path=key(p,name);
|
HomeAddress address=address(p,args);String name=address.name(),path=address.explicitWorld()?worldKey(p,name):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.");
|
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);
|
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" -> {
|
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.");
|
if(!homes.contains(path)) throw new IllegalArgumentException("That home does not exist.");
|
||||||
homes.set(path,null); save(); p.sendMessage("Home removed: "+name);
|
homes.set(path,null); save(); p.sendMessage("Home removed: "+name);
|
||||||
}
|
}
|
||||||
|
|
@ -124,9 +149,12 @@ final class EssentialsBasics implements CommandExecutor, TabCompleter, Listener
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@Override public List<String> onTabComplete(CommandSender sender,Command command,String alias,String[] args) {
|
@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()) {
|
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 "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");
|
case "server" -> List.of("arrakis","giedi_prime","caladan","kaitain","sigma_draconis_iv","spacing_guild");
|
||||||
default -> List.of();
|
default -> List.of();
|
||||||
|
|
|
||||||
|
|
@ -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);}
|
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;}}
|
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(!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;}
|
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;}
|
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;}
|
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();
|
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.");
|
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.");
|
||||||
Bukkit.getScheduler().runTaskLater(plugin,()->{
|
Runnable reserve=()->{
|
||||||
if(!token.equals(waiting.remove(p.getUniqueId()))||!p.isOnline())return;
|
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;}
|
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);}
|
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);
|
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 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 stage(String id,String value){journal.set(id+".stage",value);persist();}
|
||||||
private void attempt(String id){
|
private void attempt(String id){
|
||||||
if(!busy.add(id))return;
|
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));
|
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.
|
// 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;}
|
var connector=Bukkit.getPluginManager().getPlugin("JarvisTranslator");if(connector==null||!connector.isEnabled()){busy.remove(id);return;}
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin,()->{
|
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){}
|
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(!state.equals("pending")){journal.set(id,null);persist();return;}
|
||||||
if(!stage.equals("reserve"))return;
|
if(!stage.equals("reserve"))return;
|
||||||
Player current=Bukkit.getPlayer(UUID.fromString(id));Location target=journal.getLocation(id+".destination");
|
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.
|
// 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,()->{
|
current.teleportAsync(target).whenComplete((success,failure)->Bukkit.getScheduler().runTask(plugin,()->{
|
||||||
stage(id,Boolean.TRUE.equals(success)&&failure==null?"arrive":"cancel");busy.remove(id);
|
boolean arrived=Boolean.TRUE.equals(success)&&failure==null;
|
||||||
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);
|
stage(id,arrived?"arrive":"cancel");busy.remove(id);
|
||||||
|
if(arrived&&rescue&¤t.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;
|
teleporting=true;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,16 @@ commands:
|
||||||
essentials:
|
essentials:
|
||||||
description: Open DuneRealms Essentials
|
description: Open DuneRealms Essentials
|
||||||
permission: duneess.basics
|
permission: duneess.basics
|
||||||
|
rescue:
|
||||||
|
description: Emergency teleport and heal for 1,000 DM
|
||||||
|
usage: /rescue
|
||||||
home:
|
home:
|
||||||
description: Teleport to a saved home
|
description: Teleport to a saved home on your current world
|
||||||
|
usage: /home [world] [name]
|
||||||
permission: duneess.basics
|
permission: duneess.basics
|
||||||
sethome:
|
sethome:
|
||||||
description: Save a named home
|
description: Save a named home on your current world
|
||||||
|
usage: /sethome [world] [name]
|
||||||
permission: duneess.basics
|
permission: duneess.basics
|
||||||
delhome:
|
delhome:
|
||||||
description: Remove a named home
|
description: Remove a named home
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,5 @@ tasks.test { useJUnitPlatform() }
|
||||||
sourceSets.main { java.srcDir("../gui-common/src/main/java") }
|
sourceSets.main { java.srcDir("../gui-common/src/main/java") }
|
||||||
|
|
||||||
tasks.jar { archiveFileName.set("DuneRealms-Lobby.jar") }
|
tasks.jar { archiveFileName.set("DuneRealms-Lobby.jar") }
|
||||||
|
|
||||||
|
sourceSets.main { java.srcDir("../citizens-common/src/main/java") }
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public final class DuneLobby extends JavaPlugin implements Listener, CommandExec
|
||||||
@Override public boolean shouldGenerateStructures() { return false; }
|
@Override public boolean shouldGenerateStructures() { return false; }
|
||||||
}
|
}
|
||||||
@Override public void onEnable() {
|
@Override public void onEnable() {
|
||||||
saveDefaultConfig(); roleKey=new NamespacedKey(this,"role");
|
saveDefaultConfig(); roleKey=new NamespacedKey(this,"role"); com.dunerealms.npc.CitizensBridge.start(this,roleKey);
|
||||||
getCommand("lobby").setExecutor(this); getCommand("dunelobby").setExecutor(this);
|
getCommand("lobby").setExecutor(this); getCommand("dunelobby").setExecutor(this);
|
||||||
Bukkit.getPluginManager().registerEvents(this,this);
|
Bukkit.getPluginManager().registerEvents(this,this);
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(this,"BungeeCord");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(this,"BungeeCord");
|
||||||
|
|
@ -92,7 +92,7 @@ public final class DuneLobby extends JavaPlugin implements Listener, CommandExec
|
||||||
npc("spice","Discreet Spice Seller",-54,81,110,Villager.Profession.LEATHERWORKER);
|
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) {
|
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;
|
for(LivingEntity entity:lobby.getEntitiesByClass(LivingEntity.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->{
|
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.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.setInvulnerable(true); v.setPersistent(true); v.setRemoveWhenFarAway(false); v.setProfession(profession);
|
||||||
|
|
@ -147,7 +147,7 @@ public final class DuneLobby extends JavaPlugin implements Listener, CommandExec
|
||||||
if(!lobby.getBlockAt(p[0],128,p[1]).getType().isOccluding()) failures.add("missing flat ceiling "+Arrays.toString(p));
|
if(!lobby.getBlockAt(p[0],128,p[1]).getType().isOccluding()) failures.add("missing flat ceiling "+Arrays.toString(p));
|
||||||
for(int y:new int[]{81,96,120}) for(int[] p:new int[][]{{-126,0},{96,0},{0,-98},{0,130}})
|
for(int y:new int[]{81,96,120}) for(int[] p:new int[][]{{-126,0},{96,0},{0,-98},{0,130}})
|
||||||
if(!lobby.getBlockAt(p[0],y,p[1]).getType().isOccluding()) failures.add("visible sky boundary "+Arrays.toString(p));
|
if(!lobby.getBlockAt(p[0],y,p[1]).getType().isOccluding()) failures.add("visible sky boundary "+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);
|
for(String role:List.of("liaison","exchange","water","spice")) if(lobby.getEntitiesByClass(LivingEntity.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();
|
long art=lobby.getEntitiesByClass(ItemFrame.class).stream().filter(v->v.getPersistentDataContainer().has(new NamespacedKey(this,"art"),PersistentDataType.STRING)).count();
|
||||||
if(art!=LobbyArtwork.tileCount()) failures.add("art frames "+art+" != "+LobbyArtwork.tileCount());
|
if(art!=LobbyArtwork.tileCount()) failures.add("art frames "+art+" != "+LobbyArtwork.tileCount());
|
||||||
String result="GUILD_VERIFY "+(failures.isEmpty()?"PASS":"FAIL")+" walkable="+seen.size()+" artwork="+art+" "+failures;
|
String result="GUILD_VERIFY "+(failures.isEmpty()?"PASS":"FAIL")+" walkable="+seen.size()+" artwork="+art+" "+failures;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ version: 1.1.0
|
||||||
main: com.example.dunelobby.DuneLobby
|
main: com.example.dunelobby.DuneLobby
|
||||||
api-version: '1.21.8'
|
api-version: '1.21.8'
|
||||||
load: POSTWORLD
|
load: POSTWORLD
|
||||||
softdepend: [floodgate, ViaVersion, ImageFrame, DuneEss, DuneCore]
|
softdepend: [Citizens, Citizens, floodgate, ViaVersion, ImageFrame, DuneEss, DuneCore]
|
||||||
commands:
|
commands:
|
||||||
lobby:
|
lobby:
|
||||||
description: Return to the Vaerkring lobby
|
description: Return to the Vaerkring lobby
|
||||||
|
|
|
||||||
|
|
@ -27,3 +27,5 @@ tasks.jar { archiveFileName.set("DuneRealms-NPC.jar") }
|
||||||
val mockitoAgent by configurations.creating
|
val mockitoAgent by configurations.creating
|
||||||
dependencies { mockitoAgent("org.mockito:mockito-core:5.15.2") { isTransitive = false } }
|
dependencies { mockitoAgent("org.mockito:mockito-core:5.15.2") { isTransitive = false } }
|
||||||
tasks.test { jvmArgs("-javaagent:${mockitoAgent.singleFile.absolutePath}") }
|
tasks.test { jvmArgs("-javaagent:${mockitoAgent.singleFile.absolutePath}") }
|
||||||
|
|
||||||
|
sourceSets.main { java.srcDir("../citizens-common/src/main/java") }
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ import java.util.*;
|
||||||
public final class DuneNPC extends JavaPlugin implements Listener, CommandExecutor, TabCompleter {
|
public final class DuneNPC extends JavaPlugin implements Listener, CommandExecutor, TabCompleter {
|
||||||
private DuneCore core;
|
private DuneCore core;
|
||||||
private Smugglers smugglers;
|
private Smugglers smugglers;
|
||||||
|
private SmugglerCover cover;
|
||||||
|
SmugglerCover cover() { return cover; }
|
||||||
private NamespacedKey guildKey;
|
private NamespacedKey guildKey;
|
||||||
private static final Set<String> PLANETS = Set.of("arrakis", "caladan", "kaitain", "giedi_prime", "sigma_draconis_iv");
|
private static final Set<String> PLANETS = Set.of("arrakis", "caladan", "kaitain", "giedi_prime", "sigma_draconis_iv");
|
||||||
private static final class Menu implements InventoryHolder {
|
private static final class Menu implements InventoryHolder {
|
||||||
|
|
@ -49,13 +51,16 @@ public final class DuneNPC extends JavaPlugin implements Listener, CommandExecut
|
||||||
var registration = Bukkit.getServicesManager().getRegistration(Economy.class);
|
var registration = Bukkit.getServicesManager().getRegistration(Economy.class);
|
||||||
if (registration == null) { getLogger().severe("Vault economy unavailable."); Bukkit.getPluginManager().disablePlugin(this); return; }
|
if (registration == null) { getLogger().severe("Vault economy unavailable."); Bukkit.getPluginManager().disablePlugin(this); return; }
|
||||||
guildKey = new NamespacedKey("dunerealms", "guild");
|
guildKey = new NamespacedKey("dunerealms", "guild");
|
||||||
|
com.dunerealms.npc.CitizensBridge.start(this,guildKey,new NamespacedKey("dunecore","smuggler"));
|
||||||
smugglers = new Smugglers(this, registration.getProvider(), core.politics());
|
smugglers = new Smugglers(this, registration.getProvider(), core.politics());
|
||||||
|
cover = new SmugglerCover(this);
|
||||||
|
cover.register();
|
||||||
Objects.requireNonNull(getCommand("dunenpc")).setExecutor(this);
|
Objects.requireNonNull(getCommand("dunenpc")).setExecutor(this);
|
||||||
Objects.requireNonNull(getCommand("dunenpc")).setTabCompleter(this);
|
Objects.requireNonNull(getCommand("dunenpc")).setTabCompleter(this);
|
||||||
Bukkit.getPluginManager().registerEvents(this, this);
|
Bukkit.getPluginManager().registerEvents(this, this);
|
||||||
Bukkit.getScheduler().runTask(this, () -> Bukkit.getWorlds().forEach(this::ensureGuildNpc));
|
Bukkit.getScheduler().runTask(this, () -> Bukkit.getWorlds().forEach(this::ensureGuildNpc));
|
||||||
}
|
}
|
||||||
@Override public void onDisable() { if (smugglers != null) smugglers.shutdown(); }
|
@Override public void onDisable() { if (smugglers != null) smugglers.shutdown(); if (cover != null) cover.shutdown(); }
|
||||||
private void migrateData() throws IOException {
|
private void migrateData() throws IOException {
|
||||||
for (String name : List.of("smuggling.yml", "smuggler-camps.yml")) {
|
for (String name : List.of("smuggling.yml", "smuggler-camps.yml")) {
|
||||||
File source = new File(core.getDataFolder(), name), destination = new File(getDataFolder(), name);
|
File source = new File(core.getDataFolder(), name), destination = new File(getDataFolder(), name);
|
||||||
|
|
@ -72,8 +77,8 @@ public final class DuneNPC extends JavaPlugin implements Listener, CommandExecut
|
||||||
if (!PLANETS.contains(world.getName().toLowerCase(Locale.ROOT)) || !getConfig().getBoolean("guild-npc.enabled", true)) return;
|
if (!PLANETS.contains(world.getName().toLowerCase(Locale.ROOT)) || !getConfig().getBoolean("guild-npc.enabled", true)) return;
|
||||||
Location spawn = world.getSpawnLocation();
|
Location spawn = world.getSpawnLocation();
|
||||||
world.getChunkAt(spawn).load();
|
world.getChunkAt(spawn).load();
|
||||||
for (Entity entity : world.getNearbyEntities(spawn, 12, 8, 12))
|
for (Entity entity : world.getEntitiesByClass(LivingEntity.class))
|
||||||
if (entity instanceof Villager && entity.getPersistentDataContainer().has(guildKey, PersistentDataType.BYTE)) return;
|
if (entity.getPersistentDataContainer().has(guildKey, PersistentDataType.BYTE)) return;
|
||||||
int x = spawn.getBlockX() + 2, z = spawn.getBlockZ();
|
int x = spawn.getBlockX() + 2, z = spawn.getBlockZ();
|
||||||
for (int dx = -3; dx <= 3; dx++) for (int dz = -3; dz <= 3; dz++) {
|
for (int dx = -3; dx <= 3; dx++) for (int dz = -3; dz <= 3; dz++) {
|
||||||
int bx = x + dx, bz = z + dz;
|
int bx = x + dx, bz = z + dz;
|
||||||
|
|
@ -96,8 +101,7 @@ public final class DuneNPC extends JavaPlugin implements Listener, CommandExecut
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@EventHandler public void navigator(PlayerInteractEntityEvent event) {
|
@EventHandler public void navigator(PlayerInteractEntityEvent event) {
|
||||||
if (!(event.getRightClicked() instanceof Villager)
|
if (!event.getRightClicked().getPersistentDataContainer().has(guildKey, PersistentDataType.BYTE)) return;
|
||||||
|| !event.getRightClicked().getPersistentDataContainer().has(guildKey, PersistentDataType.BYTE)) return;
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (event.getHand() == EquipmentSlot.HAND) Bukkit.dispatchCommand(event.getPlayer(), "duneess travel");
|
if (event.getHand() == EquipmentSlot.HAND) Bukkit.dispatchCommand(event.getPlayer(), "duneess travel");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,11 @@ final class SmugglerCamps {
|
||||||
void sync(Set<UUID> active) {
|
void sync(Set<UUID> active) {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
for (UUID id : active) {
|
for (UUID id : active) {
|
||||||
Entity entity = Bukkit.getEntity(id);
|
Entity entity = com.dunerealms.npc.CitizensBridge.resolve(id);
|
||||||
if (!(entity instanceof WanderingTrader trader)) continue;
|
if (!(entity instanceof LivingEntity trader)) continue;
|
||||||
if (!camps.containsKey(id)) {
|
if (!camps.containsKey(id)) {
|
||||||
camps.put(id, new Camp(trader.getWorld().getUID(), trader.hasAI(), trader.hasGravity(),
|
camps.put(id, new Camp(trader.getWorld().getUID(), (trader instanceof Mob mob && mob.hasAI()), trader.hasGravity(),
|
||||||
trader.isCollidable(), trader.isInvulnerable(), trader.getDespawnDelay()));
|
trader.isCollidable(), trader.isInvulnerable(), (trader instanceof WanderingTrader wandering ? wandering.getDespawnDelay() : Integer.MAX_VALUE)));
|
||||||
planLights(id, trader.getLocation());
|
planLights(id, trader.getLocation());
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
@ -62,24 +62,24 @@ final class SmugglerCamps {
|
||||||
if (pendingSave && !save()) return;
|
if (pendingSave && !save()) return;
|
||||||
for (UUID id : active) {
|
for (UUID id : active) {
|
||||||
if (!camps.containsKey(id)) continue;
|
if (!camps.containsKey(id)) continue;
|
||||||
Entity entity = Bukkit.getEntity(id);
|
Entity entity = com.dunerealms.npc.CitizensBridge.resolve(id);
|
||||||
if (entity instanceof WanderingTrader trader) {
|
if (entity instanceof LivingEntity trader) {
|
||||||
trader.setAI(false);
|
if(trader instanceof Mob mob)mob.setAI(false);
|
||||||
trader.setGravity(false);
|
trader.setGravity(false);
|
||||||
trader.setCollidable(false);
|
trader.setCollidable(false);
|
||||||
trader.setInvulnerable(true);
|
trader.setInvulnerable(true);
|
||||||
trader.setVelocity(new Vector());
|
trader.setVelocity(new Vector());
|
||||||
trader.setDespawnDelay(Integer.MAX_VALUE);
|
if(trader instanceof WanderingTrader wandering)wandering.setDespawnDelay(Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var iterator = camps.entrySet().iterator(); iterator.hasNext();) {
|
for (var iterator = camps.entrySet().iterator(); iterator.hasNext();) {
|
||||||
var entry = iterator.next();
|
var entry = iterator.next();
|
||||||
if (active.contains(entry.getKey())) continue;
|
if (active.contains(entry.getKey())) continue;
|
||||||
Entity entity = Bukkit.getEntity(entry.getKey());
|
Entity entity = com.dunerealms.npc.CitizensBridge.resolve(entry.getKey());
|
||||||
if (entity instanceof WanderingTrader trader) {
|
if (entity instanceof LivingEntity trader) {
|
||||||
Camp camp = entry.getValue();
|
Camp camp = entry.getValue();
|
||||||
trader.setAI(camp.ai()); trader.setGravity(camp.gravity()); trader.setCollidable(camp.collidable());
|
if(trader instanceof Mob mob)mob.setAI(camp.ai()); trader.setGravity(camp.gravity()); trader.setCollidable(camp.collidable());
|
||||||
trader.setInvulnerable(camp.invulnerable()); trader.setDespawnDelay(camp.despawn());
|
trader.setInvulnerable(camp.invulnerable()); if(trader instanceof WanderingTrader wandering)wandering.setDespawnDelay(camp.despawn());
|
||||||
iterator.remove(); changed = true;
|
iterator.remove(); changed = true;
|
||||||
}
|
}
|
||||||
// Keep unloaded trader records until its chunk is loaded, so AI can be restored then.
|
// Keep unloaded trader records until its chunk is loaded, so AI can be restored then.
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue

Staff