The Wild Update — Beta 1.0.3.0 #68
1237 changed files with 12519 additions and 112 deletions
42
.forgejo/workflows/citizens-ready-barrier.yml
Normal file
42
.forgejo/workflows/citizens-ready-barrier.yml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
name: Citizens Load Barrier Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ['feat/citizens-ready-barrier-*']
|
||||
|
||||
jobs:
|
||||
citizens-ready:
|
||||
runs-on: dune-ci
|
||||
steps:
|
||||
- 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/plugins.git "$GITHUB_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
gradle-version: '9.2.1'
|
||||
- name: Build and verify the scoped runtime fix
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gradle --no-daemon -p DuneNPC test jar
|
||||
gradle --no-daemon -p DuneLobby test jar
|
||||
mkdir citizens-ready-artifacts
|
||||
python3 tools/plugin_citizens_ready.py extract DuneNPC/build/libs/DuneRealms-NPC.jar DuneLobby/build/libs/DuneRealms-Lobby.jar citizens-ready-artifacts/citizens-ready.overlay.zip
|
||||
cp tools/{plugin_citizens_ready,plugin_wild_update}.py citizens-ready-artifacts/
|
||||
printf '%s\n' "$(git rev-parse HEAD)" > citizens-ready-artifacts/SOURCE_COMMIT
|
||||
(cd citizens-ready-artifacts && sha256sum -- *.zip *.py SOURCE_COMMIT > SHA256SUMS)
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DuneRealms-Citizens-Load-Barrier
|
||||
path: citizens-ready-artifacts/
|
||||
if-no-files-found: error
|
||||
40
.forgejo/workflows/dune-staff.yml
Normal file
40
.forgejo/workflows/dune-staff.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
name: DuneStaff Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ['feat/staff-tools-*']
|
||||
|
||||
jobs:
|
||||
dune-staff:
|
||||
runs-on: dune-ci
|
||||
steps:
|
||||
- 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/plugins.git "$GITHUB_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
gradle-version: '9.2.1'
|
||||
- name: Build standalone staff plugin
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gradle --no-daemon -p DuneStaff build
|
||||
mkdir dune-staff-artifacts
|
||||
cp DuneStaff/build/libs/DuneStaff.jar dune-staff-artifacts/
|
||||
printf '%s\n' "$(git rev-parse HEAD)" > dune-staff-artifacts/SOURCE_COMMIT
|
||||
(cd dune-staff-artifacts && sha256sum -- DuneStaff.jar SOURCE_COMMIT > SHA256SUMS)
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DuneRealms-DuneStaff
|
||||
path: dune-staff-artifacts/
|
||||
if-no-files-found: error
|
||||
41
.forgejo/workflows/item-origin-remainders.yml
Normal file
41
.forgejo/workflows/item-origin-remainders.yml
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
name: Item Origin Remainders Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ['feat/item-origin-remainders-*']
|
||||
|
||||
jobs:
|
||||
item-origin:
|
||||
runs-on: dune-ci
|
||||
steps:
|
||||
- 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/plugins.git "$GITHUB_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
gradle-version: '9.2.1'
|
||||
- name: Build tested provenance classes
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gradle --no-daemon -p JarvisConnector test jar
|
||||
mkdir item-origin-artifacts
|
||||
python3 tools/plugin_item_origin.py extract JarvisConnector/build/libs/jarvistranslator.jar item-origin-artifacts/item-origin.overlay.zip
|
||||
cp tools/{plugin_item_origin,plugin_wild_update}.py item-origin-artifacts/
|
||||
printf '%s\n' "$(git rev-parse HEAD)" > item-origin-artifacts/SOURCE_COMMIT
|
||||
(cd item-origin-artifacts && sha256sum -- *.zip *.py SOURCE_COMMIT > SHA256SUMS)
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DuneRealms-Item-Origin
|
||||
path: item-origin-artifacts/
|
||||
if-no-files-found: error
|
||||
|
|
@ -60,7 +60,13 @@ jobs:
|
|||
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 5d727d7f59e6af26fba07a3878fd79035a5923ce
|
||||
git worktree add --detach "$pillager_input/navigator" FETCH_HEAD
|
||||
gradle --no-daemon -p "$pillager_input/navigator/JarvisConnector" jar
|
||||
python3 tools/plugin_navigator_transition.py --historical-jarvis "$pillager_input/navigator/JarvisConnector/build/libs/jarvistranslator.jar"
|
||||
# Check the final accepted Navigator frontends at their source pin; the current
|
||||
# tree has independent required tests and can legitimately contain newer artwork.
|
||||
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 313db14fb4fdda1f7193e86499f1041b15e9d04b
|
||||
git worktree add --detach "$pillager_input/navigator-frontends" FETCH_HEAD
|
||||
gradle --no-daemon -p "$pillager_input/navigator-frontends/DuneMenus" jar
|
||||
gradle --no-daemon -p "$pillager_input/navigator-frontends/DuneRealmsGUI" jar
|
||||
python3 tools/plugin_navigator_transition.py --historical-jarvis "$pillager_input/navigator/JarvisConnector/build/libs/jarvistranslator.jar" --historical-frontends "$pillager_input/navigator-frontends"
|
||||
python3 tools/test_plugin_pillager_art.py -v
|
||||
python3 tools/test_plugin_fleet_install.py -v
|
||||
python3 tools/test_plugin_menu_pack.py -v
|
||||
|
|
|
|||
55
.forgejo/workflows/spice-cookers-rails.yml
Normal file
55
.forgejo/workflows/spice-cookers-rails.yml
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
name: Spice Cookers and Rails Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ['feat/spice-cookers-rails-*']
|
||||
|
||||
jobs:
|
||||
spice-cookers-rails:
|
||||
runs-on: dune-ci
|
||||
steps:
|
||||
- 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/plugins.git "$GITHUB_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
gradle-version: '9.2.1'
|
||||
- name: Build tested cookers and patched rails from pinned source
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
build="$(mktemp -d)"
|
||||
mkdir spice-rail-artifacts
|
||||
git clone --quiet --no-checkout https://github.com/Fridtjof-DE/MinecartTrains.git "$build/rails"
|
||||
git -C "$build/rails" checkout --detach 2f19054927c96fdf1d025b3e9f6a32c5534aef2a
|
||||
cmp vendor/minecart-trains/LICENSE.upstream "$build/rails/LICENSE"
|
||||
git -C "$build/rails" apply "$PWD/vendor/minecart-trains/spice-coal.patch"
|
||||
curl --fail --location --retry 2 https://cdn.modrinth.com/data/PSN4XhQK/versions/G2YwbBLw/PuddingAPI-2611162255.jar -o "$build/PuddingAPI-2611162255.jar"
|
||||
(cd "$build" && printf '%s PuddingAPI-2611162255.jar\n' 8c6504f09e6d7b384a4a2651ed33a1b28c7b41a4e42aff89f0e459524697e304 | sha256sum --check)
|
||||
for module in JarvisConnector DuneRealmsGUI DuneMenus; do
|
||||
gradle --no-daemon -p "$module" test jar
|
||||
done
|
||||
gradle --no-daemon -p vendor/minecart-trains jar "-PrailsSource=$build/rails" "-PpuddingJar=$build/PuddingAPI-2611162255.jar"
|
||||
python3 tools/build-unified-resourcepack.py --source "$GITHUB_SHA" --output "$build/resource-validation.zip"
|
||||
python3 tools/plugin_spice_cookers.py extract network/resource-pack/central/overlay JarvisConnector/build/libs/jarvistranslator.jar DuneRealmsGUI/build/libs/DunerealmsGUI.jar DuneMenus/build/libs/DuneMenus.jar spice-rail-artifacts
|
||||
cp vendor/minecart-trains/build/libs/MinecartTrains-1.4.3-dune1.jar "$build/PuddingAPI-2611162255.jar" spice-rail-artifacts/
|
||||
cp vendor/minecart-trains/{build.gradle.kts,settings.gradle.kts,spice-coal.patch} "$build/rails/"
|
||||
tar -czf spice-rail-artifacts/MinecartTrains-1.4.3-dune1-source.tar.gz -C "$build/rails" LICENSE README.md pom.xml build.gradle.kts settings.gradle.kts spice-coal.patch src
|
||||
cp tools/{plugin_spice_cookers,plugin_wild_update}.py spice-rail-artifacts/
|
||||
printf '%s\n' "$(git rev-parse HEAD)" > spice-rail-artifacts/SOURCE_COMMIT
|
||||
(cd spice-rail-artifacts && sha256sum -- *.zip *.tar.gz *.jar *.py SOURCE_COMMIT > SHA256SUMS)
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DuneRealms-Spice-Cookers-Rails
|
||||
path: spice-rail-artifacts/
|
||||
if-no-files-found: error
|
||||
38
.forgejo/workflows/supplied-item-art.yml
Normal file
38
.forgejo/workflows/supplied-item-art.yml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
name: Supplied Dune Item Art Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ['feat/supplied-item-art-*']
|
||||
|
||||
jobs:
|
||||
supplied-item-art:
|
||||
runs-on: dune-ci
|
||||
steps:
|
||||
- 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/plugins.git "$GITHUB_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- name: Build both retained pack variants
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir supplied-item-art
|
||||
python3 tools/build-unified-resourcepack.py --source "$GITHUB_SHA" --output candidate-source.zip
|
||||
curl --fail --location --retry 2 https://www.dunerealms.com/downloads/DuneRealms-Resources-ab1b9f8915ba2a68a7388cdf5f55ff76349b0339.zip -o arrakis-baseline.zip
|
||||
curl --fail --location --retry 2 https://www.dunerealms.com/downloads/DuneRealms-Resources-2faba139906da15741db2702b3bed3e92ad7ee26.zip -o fleet-baseline.zip
|
||||
for variant in arrakis fleet; do
|
||||
python3 tools/plugin_supplied_item_art.py "$variant" "$variant-baseline.zip" candidate-source.zip network/resource-pack/dune-items/publication-pins.json "supplied-item-art/DuneRealms-ItemArt-$GITHUB_SHA-$variant.zip" > "supplied-item-art/$variant.json"
|
||||
done
|
||||
printf '%s\n' "$(git rev-parse HEAD)" > supplied-item-art/SOURCE_COMMIT
|
||||
cp tools/plugin_supplied_item_art.py network/resource-pack/dune-items/publication-pins.json supplied-item-art/
|
||||
(cd supplied-item-art && sha256sum -- *.zip *.json *.py SOURCE_COMMIT > SHA256SUMS)
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DuneRealms-Supplied-Item-Art
|
||||
path: supplied-item-art/
|
||||
if-no-files-found: error
|
||||
70
.forgejo/workflows/wild-release.yml
Normal file
70
.forgejo/workflows/wild-release.yml
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
name: Wild Update Release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ['feat/wild-release-*']
|
||||
|
||||
jobs:
|
||||
wild-release:
|
||||
runs-on: dune-ci
|
||||
steps:
|
||||
- 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/plugins.git "$GITHUB_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
gradle-version: '9.2.1'
|
||||
- name: Build exact-source runtime overlays, rails and packs
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
build="$(mktemp -d)"
|
||||
release="$PWD/wild-release"
|
||||
mkdir -p "$release"/{packs,plugins,cookers}
|
||||
for module in DuneLobby DuneNPC DuneRealmsGUI DuneMenus DuneTerrain JarvisConnector DuneStaff; do
|
||||
gradle --no-daemon -p "$module" test jar
|
||||
done
|
||||
python3 tools/test_plugin_wild_update.py -v
|
||||
python3 tools/plugin_wild_update.py extract . "$release/wild" "$GITHUB_SHA"
|
||||
python3 tools/plugin_item_origin.py extract JarvisConnector/build/libs/jarvistranslator.jar "$release/plugins/item-origin.overlay.zip"
|
||||
python3 tools/plugin_spice_cookers.py extract network/resource-pack/central/overlay JarvisConnector/build/libs/jarvistranslator.jar DuneRealmsGUI/build/libs/DunerealmsGUI.jar DuneMenus/build/libs/DuneMenus.jar "$release/cookers"
|
||||
cp DuneStaff/build/libs/DuneStaff.jar "$release/plugins/"
|
||||
git clone --quiet --no-checkout https://github.com/Fridtjof-DE/MinecartTrains.git "$build/rails"
|
||||
git -C "$build/rails" checkout --detach 2f19054927c96fdf1d025b3e9f6a32c5534aef2a
|
||||
cmp vendor/minecart-trains/LICENSE.upstream "$build/rails/LICENSE"
|
||||
git -C "$build/rails" apply "$PWD/vendor/minecart-trains/spice-coal.patch"
|
||||
curl --fail --location --retry 2 https://cdn.modrinth.com/data/PSN4XhQK/versions/G2YwbBLw/PuddingAPI-2611162255.jar -o "$build/PuddingAPI-2611162255.jar"
|
||||
(cd "$build" && printf '%s PuddingAPI-2611162255.jar\n' 8c6504f09e6d7b384a4a2651ed33a1b28c7b41a4e42aff89f0e459524697e304 | sha256sum --check)
|
||||
gradle --no-daemon -p vendor/minecart-trains jar "-PrailsSource=$build/rails" "-PpuddingJar=$build/PuddingAPI-2611162255.jar"
|
||||
cp vendor/minecart-trains/build/libs/MinecartTrains-1.4.3-dune1.jar "$build/PuddingAPI-2611162255.jar" "$release/plugins/"
|
||||
cp vendor/minecart-trains/{build.gradle.kts,settings.gradle.kts,spice-coal.patch} "$build/rails/"
|
||||
tar -czf "$release/plugins/MinecartTrains-1.4.3-dune1-source.tar.gz" -C "$build/rails" LICENSE README.md pom.xml build.gradle.kts settings.gradle.kts spice-coal.patch src
|
||||
python3 tools/build-unified-resourcepack.py --source "$GITHUB_SHA" --output "$build/candidate-source.zip"
|
||||
curl --fail --location --retry 2 https://www.dunerealms.com/downloads/DuneRealms-Resources-ab1b9f8915ba2a68a7388cdf5f55ff76349b0339.zip -o "$build/arrakis-baseline.zip"
|
||||
curl --fail --location --retry 2 https://www.dunerealms.com/downloads/DuneRealms-Resources-2faba139906da15741db2702b3bed3e92ad7ee26.zip -o "$build/fleet-baseline.zip"
|
||||
pins=network/resource-pack/dune-items/publication-pins.json
|
||||
art="$release/cookers/spice-cookers.art.zip"
|
||||
for variant in arrakis fleet; do
|
||||
corrected="$build/$variant-corrected.zip"
|
||||
python3 tools/plugin_supplied_item_art.py "$variant" "$build/$variant-baseline.zip" "$build/candidate-source.zip" "$pins" "$corrected" > "$release/packs/$variant-art-transition.json"
|
||||
python3 tools/plugin_spice_cookers.py assemble pack "$corrected" "$art" "$release/packs/DuneRealms-Wild-$GITHUB_SHA-$variant.zip" "$(sha256sum "$corrected" | cut -d' ' -f1)" "$(sha256sum "$art" | cut -d' ' -f1)"
|
||||
done
|
||||
cp tools/{plugin_citizens_ready,plugin_item_origin,plugin_spice_cookers,plugin_supplied_item_art,plugin_wild_update}.py "$release/"
|
||||
cp "$pins" network/content-assets/cookbook/spice-crafting.json "$release/"
|
||||
printf '%s\n' "$(git rev-parse HEAD)" > "$release/SOURCE_COMMIT"
|
||||
(cd "$release" && find . -type f ! -name SHA256SUMS -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS)
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DuneRealms-Wild-Beta-1.0.3.0
|
||||
path: wild-release/
|
||||
if-no-files-found: error
|
||||
43
.forgejo/workflows/wild-update.yml
Normal file
43
.forgejo/workflows/wild-update.yml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
name: The Wild Update Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ['feat/quest-journal-bundle-*']
|
||||
|
||||
jobs:
|
||||
wild-update:
|
||||
runs-on: dune-ci
|
||||
steps:
|
||||
- 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/plugins.git "$GITHUB_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
gradle-version: '9.2.1'
|
||||
- name: Build tested entry overlays
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for module in DuneLobby DuneNPC DuneRealmsGUI DuneMenus DuneTerrain JarvisConnector; do
|
||||
gradle --no-daemon -p "$module" test jar
|
||||
done
|
||||
python3 tools/test_plugin_wild_update.py -v
|
||||
python3 tools/plugin_wild_update.py extract . wild-update-artifacts "$GITHUB_SHA"
|
||||
cp tools/plugin_wild_update.py wild-update-artifacts/
|
||||
printf '%s\n' "$(git rev-parse HEAD)" > wild-update-artifacts/SOURCE_COMMIT
|
||||
(cd wild-update-artifacts && sha256sum -- *.zip *.json *.py SOURCE_COMMIT > SHA256SUMS)
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DuneRealms-Wild-Update
|
||||
path: wild-update-artifacts/
|
||||
if-no-files-found: error
|
||||
|
|
@ -41,7 +41,7 @@ public final class DuneLobby extends JavaPlugin implements Listener, CommandExec
|
|||
@Override public boolean shouldGenerateStructures() { return false; }
|
||||
}
|
||||
@Override public void onEnable() {
|
||||
saveDefaultConfig(); roleKey=new NamespacedKey(this,"role"); com.dunerealms.npc.CitizensBridge.start(this,roleKey);
|
||||
saveDefaultConfig(); roleKey=new NamespacedKey(this,"role"); com.dunerealms.npc.CitizensBridge.start(this, () -> { if(lobby!=null)ensureNpcs(); }, roleKey);
|
||||
getCommand("lobby").setExecutor(this); getCommand("dunelobby").setExecutor(this);
|
||||
Bukkit.getPluginManager().registerEvents(this,this);
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(this,"BungeeCord");
|
||||
|
|
@ -93,12 +93,8 @@ public final class DuneLobby extends JavaPlugin implements Listener, CommandExec
|
|||
}
|
||||
private void npc(String role,String name,int x,int y,int z,Villager.Profession profession) {
|
||||
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->{
|
||||
v.setCustomName(ChatColor.GOLD+name); v.setCustomNameVisible(true); v.setAI(false); v.setSilent(true);
|
||||
v.setInvulnerable(true); v.setPersistent(true); v.setRemoveWhenFarAway(false); v.setProfession(profession);
|
||||
v.setVillagerType(role.equals("water")||role.equals("spice")?Villager.Type.SWAMP:Villager.Type.DESERT);
|
||||
v.getPersistentDataContainer().set(roleKey,PersistentDataType.STRING,role); v.setRecipes(List.of());
|
||||
});
|
||||
if(!com.dunerealms.npc.CitizensBridge.ready()||com.dunerealms.npc.CitizensBridge.exists(this,lobby,roleKey,role))return;
|
||||
com.dunerealms.npc.CitizensBridge.spawnContact(this,new Location(lobby,x+.5,y,z+.5,180,0),ChatColor.GOLD+name,roleKey,role,true);
|
||||
}
|
||||
@Override public boolean onCommand(CommandSender sender,Command command,String label,String[] args) {
|
||||
if(command.getName().equals("lobby")) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ version: 1.1.0
|
|||
main: com.example.dunelobby.DuneLobby
|
||||
api-version: '1.21.8'
|
||||
load: POSTWORLD
|
||||
softdepend: [Citizens, Citizens, floodgate, ViaVersion, ImageFrame, DuneEss, DuneCore]
|
||||
softdepend: [Citizens, floodgate, ViaVersion, ImageFrame, DuneEss, DuneCore]
|
||||
commands:
|
||||
lobby:
|
||||
description: Return to the Vaerkring lobby
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ final class HubMenu extends Menu {
|
|||
door(25, Material.BLAZE_POWDER, "<#e07b2e><b>Spice", "Sell and collect", "spice");
|
||||
door(28, Material.PLAYER_HEAD, "<#eed49a><b>Your Mentat", "House briefing and missions", "mentat");
|
||||
door(29, Material.GOLD_BLOCK, "<#f2c94c><b>Imperial Postbank", "Your account", "bank");
|
||||
door(31, Material.BOOK, "<#eed49a><b>Item lore archive", "Preview issued item cards", "lore");
|
||||
door(31, Material.BOOK, "<#eed49a><b>Cookbook", "Crafting recipes and grades", "cookbook");
|
||||
door(33, Material.LIGHTNING_ROD, "<#7fd6e8><b>ATM", "Quick deposit and withdrawal", "atm");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -395,7 +395,10 @@ final class JarvisBackend implements Backend, Listener {
|
|||
if (unavailable!=null && unavailable.isBlank()) unavailable="Passage unavailable";
|
||||
String name=offer!=null&&!text(offer,"name").isBlank()?text(offer,"name"):route.getValue();
|
||||
long fare=offer!=null&&offer.has("fareMinor")?offer.get("fareMinor").getAsLong():quote.get("fareMinor").getAsLong();
|
||||
worlds.add(new World(id, name, unavailable == null ? "Imperial Guild passage" : unavailable,
|
||||
String tagline = unavailable != null ? unavailable
|
||||
: offer != null && offer.has("bountyMinor") ? "Unsanctioned arrival: " + Ui.dm(offer.get("bountyMinor").getAsLong()) + " bounty" + (yes(offer,"reduced") ? " (clan/company discount)" : "")
|
||||
: offer != null && yes(offer,"free") ? "Free passage" : "Imperial Guild passage";
|
||||
worlds.add(new World(id, name, tagline,
|
||||
Material.COMPASS, -1, unavailable == null, fare, key, version));
|
||||
}
|
||||
return List.copyOf(worlds);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.dunerealms.menus;
|
|||
import java.util.Set;import org.bukkit.entity.Player;
|
||||
/** Only the presentation changes; original JARVIS/native service callbacks own behaviour. */
|
||||
final class NativeServiceMenu extends Menu {
|
||||
static final Set<String> IDS=Set.of("hub","travel","exchange","clan","company","missions","spice","war","politics","lore","mentat","house","equipment");
|
||||
static final Set<String> IDS=Set.of("hub","travel","exchange","clan","company","missions","spice","war","politics","lore","cookbook","mentat","house","equipment");
|
||||
private final String target;
|
||||
NativeServiceMenu(DuneMenusPlugin plugin,Player player,Menu parent,String target){super(plugin,player,parent);this.target=target;}
|
||||
@Override boolean launchNative(){plugin.openNativeService(player,target);return true;}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ final class TravelMenu extends Menu {
|
|||
var w = worlds.get(i);
|
||||
String fare = w.fareMinor() > 0 ? "<gray>Fare: <gold>" + Ui.dm(w.fareMinor()) : w.fareMinor() == 0 ? "<green>Free passage" : "";
|
||||
var icon = Ui.item(w.up() ? w.icon() : Material.GRAY_DYE, (w.up() ? "<gold><b>" : "<gray>") + w.name(),
|
||||
"<gray>" + w.tagline(), w.online() < 0 ? "" : "<gray>Players: <white>" + w.online(), w.up() ? fare : "", "",
|
||||
(w.tagline().startsWith("Unsanctioned") ? "<red>" : "<gray>") + w.tagline(), w.online() < 0 ? "" : "<gray>Players: <white>" + w.online(), w.up() ? fare : "", "",
|
||||
w.up() ? "<yellow>Click to travel" : "");
|
||||
if (w.up()) put(STARS[i], icon, t -> { end(); book(w); });
|
||||
else put(STARS[i], icon);
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ class RetainedNativeMenusAbiTest {
|
|||
@Test void retainedCurrentCloseAndChoiceFacadeArePresent()throws Exception{
|
||||
assertEquals(boolean.class,DuneMenusPlugin.class.getMethod("isCurrent",Player.class,Inventory.class).getReturnType());assertEquals(void.class,DuneMenusPlugin.class.getMethod("close",Player.class,Inventory.class).getReturnType());assertEquals(boolean.class,DuneMenusPlugin.class.getMethod("showChoices",JavaPlugin.class,Player.class,String.class,String.class,List.class).getReturnType());
|
||||
}
|
||||
@Test void allPublicServiceRoutesHaveNativeEntriesInsteadOfPartialAlternateBackends(){assertEquals(Set.of("hub","travel","exchange","clan","company","missions","spice","war","politics","lore","mentat","house","equipment"),NativeServiceMenu.IDS);}
|
||||
@Test void allPublicServiceRoutesHaveNativeEntriesInsteadOfPartialAlternateBackends(){assertEquals(Set.of("hub","travel","exchange","clan","company","missions","spice","war","politics","lore","cookbook","mentat","house","equipment"),NativeServiceMenu.IDS);}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,14 +51,14 @@ public final class DuneNPC extends JavaPlugin implements Listener, CommandExecut
|
|||
var registration = Bukkit.getServicesManager().getRegistration(Economy.class);
|
||||
if (registration == null) { getLogger().severe("Vault economy unavailable."); Bukkit.getPluginManager().disablePlugin(this); return; }
|
||||
guildKey = new NamespacedKey("dunerealms", "guild");
|
||||
com.dunerealms.npc.CitizensBridge.start(this,guildKey,new NamespacedKey("dunecore","smuggler"));
|
||||
com.dunerealms.npc.CitizensBridge.start(this, () -> Bukkit.getWorlds().forEach(this::ensureGuildNpc),
|
||||
guildKey, new NamespacedKey("dunecore","smuggler"));
|
||||
smugglers = new Smugglers(this, registration.getProvider(), core.politics());
|
||||
cover = new SmugglerCover(this);
|
||||
cover.register();
|
||||
Objects.requireNonNull(getCommand("dunenpc")).setExecutor(this);
|
||||
Objects.requireNonNull(getCommand("dunenpc")).setTabCompleter(this);
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
Bukkit.getScheduler().runTask(this, () -> Bukkit.getWorlds().forEach(this::ensureGuildNpc));
|
||||
}
|
||||
@Override public void onDisable() { if (smugglers != null) smugglers.shutdown(); if (cover != null) cover.shutdown(); }
|
||||
private void migrateData() throws IOException {
|
||||
|
|
@ -93,12 +93,8 @@ public final class DuneNPC extends JavaPlugin implements Listener, CommandExecut
|
|||
}
|
||||
}
|
||||
private void spawnNavigator(Location location) {
|
||||
location.getWorld().spawn(location, Villager.class, villager -> {
|
||||
villager.setCustomName(ChatColor.LIGHT_PURPLE + "Vaerkring Navigator");
|
||||
villager.setCustomNameVisible(true); villager.setProfession(Villager.Profession.CLERIC);
|
||||
villager.setAI(false); villager.setInvulnerable(true); villager.setSilent(true); villager.setPersistent(true);
|
||||
villager.getPersistentDataContainer().set(guildKey, PersistentDataType.BYTE, (byte) 1);
|
||||
});
|
||||
if (!com.dunerealms.npc.CitizensBridge.ready() || com.dunerealms.npc.CitizensBridge.exists(this, location.getWorld(), guildKey, "1")) return;
|
||||
com.dunerealms.npc.CitizensBridge.spawnContact(this, location, ChatColor.LIGHT_PURPLE + "Vaerkring Navigator", guildKey, "1", true);
|
||||
}
|
||||
@EventHandler public void navigator(PlayerInteractEntityEvent event) {
|
||||
if (!event.getRightClicked().getPersistentDataContainer().has(guildKey, PersistentDataType.BYTE)) return;
|
||||
|
|
@ -115,7 +111,7 @@ public final class DuneNPC extends JavaPlugin implements Listener, CommandExecut
|
|||
if (!player.isOp()) { player.sendMessage(ChatColor.RED + "Operators only. Right-click an Arrakis Smuggler for missions."); return true; }
|
||||
if (args.length == 0 || args[0].equalsIgnoreCase("admin")) { openAdmin(player); return true; }
|
||||
if (args[0].equalsIgnoreCase("smuggler")) {
|
||||
if (!getConfig().getBoolean("smugglers.enabled", true)) { player.sendMessage("Smugglers are disabled in DuneNPC/config.yml."); return true; }
|
||||
if (getConfig().getBoolean("smugglers.fixed-contracts.enabled", false) || !getConfig().getBoolean("smugglers.enabled", true)) { player.sendMessage("Smugglers are disabled in DuneNPC/config.yml."); return true; }
|
||||
if (!player.getWorld().getName().equalsIgnoreCase("arrakis")) { player.sendMessage("Spawn smugglers on Arrakis."); return true; }
|
||||
smugglers.spawnAt(player.getLocation()); player.sendMessage("Arrakis Smuggler placed."); return true;
|
||||
}
|
||||
|
|
@ -168,7 +164,7 @@ public final class DuneNPC extends JavaPlugin implements Listener, CommandExecut
|
|||
@Override public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (args.length == 1) return (sender.isOp() ? List.of("admin", "guildnpc", "smuggler", "status", "smuggle") : List.of("smuggle"))
|
||||
.stream().filter(item -> item.startsWith(args[0].toLowerCase(Locale.ROOT))).toList();
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("smuggle")) return List.of("status", "cancel").stream()
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("smuggle")) return List.of("status", "contract", "cancel").stream()
|
||||
.filter(item -> item.startsWith(args[1].toLowerCase(Locale.ROOT))).toList();
|
||||
return List.of();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,46 @@ final class Smugglers implements Listener {
|
|||
Bukkit.getScheduler().runTaskTimer(plugin, this::populate, 100L, 1200L);
|
||||
Bukkit.getScheduler().runTaskTimer(plugin, this::updateCamps, 1L, 20L);
|
||||
}
|
||||
private static final NamespacedKey QUEST_CONTACT = new NamespacedKey("dunerealms", "quest_character");
|
||||
private static final String ESMAR = "esmar_tuek", STABAN = "staban_tuek";
|
||||
|
||||
private boolean fixedContracts() {
|
||||
return plugin.getConfig().getBoolean("smugglers.fixed-contracts.enabled", false);
|
||||
}
|
||||
private boolean roamingEnabled() {
|
||||
return !fixedContracts() && plugin.getConfig().getBoolean("smugglers.enabled", true);
|
||||
}
|
||||
private String fixedRole(Entity entity) {
|
||||
if (!entity.getWorld().getName().equals("arrakis")) return null;
|
||||
String role = entity.getPersistentDataContainer().get(QUEST_CONTACT, PersistentDataType.STRING);
|
||||
if (!ESMAR.equals(role) && !STABAN.equals(role)) return null;
|
||||
var contact = com.dunerealms.npc.CitizensBridge.contact(entity.getWorld(), QUEST_CONTACT, role);
|
||||
return contact != null && contact.id().equals(com.dunerealms.npc.CitizensBridge.identity(entity)) ? role : null;
|
||||
}
|
||||
private boolean contractContact(Entity entity) {
|
||||
if (!fixedContracts()) return roamingEnabled() && tagged(entity);
|
||||
String role = fixedRole(entity);
|
||||
return ESMAR.equals(role) || STABAN.equals(role);
|
||||
}
|
||||
private LivingEntity fixedContact(World world, String role) {
|
||||
if (!world.getName().equals("arrakis")) return null;
|
||||
LivingEntity contact = null;
|
||||
for (LivingEntity candidate : world.getEntitiesByClass(LivingEntity.class)) {
|
||||
if (!candidate.isValid() || !role.equals(fixedRole(candidate))) continue;
|
||||
if (contact != null) return null;
|
||||
contact = candidate;
|
||||
}
|
||||
return contact;
|
||||
}
|
||||
private boolean fixedPairReady(Entity esmar) {
|
||||
if (!ESMAR.equals(fixedRole(esmar)) || fixedContact(esmar.getWorld(), ESMAR) != esmar) return false;
|
||||
var staban = com.dunerealms.npc.CitizensBridge.contact(esmar.getWorld(), QUEST_CONTACT, STABAN);
|
||||
if (staban == null || staban.id().equals(com.dunerealms.npc.CitizensBridge.identity(esmar))) return false;
|
||||
Location source = esmar.getLocation();
|
||||
Location destination = staban.location();
|
||||
return Math.hypot(source.getX() - destination.getX(), source.getZ() - destination.getZ()) >= 64;
|
||||
}
|
||||
|
||||
private Set<UUID> activeSources() {
|
||||
Set<UUID> ids = new HashSet<>();
|
||||
for (Contract contract : contracts.values()) ids.add(contract.source());
|
||||
|
|
@ -72,9 +112,9 @@ final class Smugglers implements Listener {
|
|||
}
|
||||
private void updateCamps() {
|
||||
expireContracts();
|
||||
Set<UUID> active = plugin.getConfig().getBoolean("smugglers.enabled", true) ? activeSources() : Set.of();
|
||||
Set<UUID> active = roamingEnabled() ? activeSources() : Set.of();
|
||||
camps.sync(active);
|
||||
if (!plugin.getConfig().getBoolean("smugglers.enabled", true)) return;
|
||||
if (!roamingEnabled()) return;
|
||||
World world = Bukkit.getWorld("arrakis");
|
||||
if (world == null) return;
|
||||
for (LivingEntity trader : world.getEntitiesByClass(LivingEntity.class)) if (tagged(trader)) {
|
||||
|
|
@ -110,7 +150,7 @@ final class Smugglers implements Listener {
|
|||
}
|
||||
int activeCount() { expireContracts(); return contracts.size(); }
|
||||
void spawnAt(Location location) {
|
||||
if (!plugin.getConfig().getBoolean("smugglers.enabled", true)) return;
|
||||
if (!roamingEnabled()) return;
|
||||
com.dunerealms.npc.CitizensBridge.spawnContact(plugin,location,"Arrakis Smuggler",traderKey);
|
||||
}
|
||||
private boolean tagged(Entity entity) {
|
||||
|
|
@ -129,7 +169,7 @@ final class Smugglers implements Listener {
|
|||
if(event.getEntity() instanceof WanderingTrader && event.getEntity().getWorld().getName().equalsIgnoreCase("arrakis")) event.setCancelled(true);
|
||||
}
|
||||
private void populate() {
|
||||
if (!plugin.getConfig().getBoolean("smugglers.enabled", true)) return;
|
||||
if (!roamingEnabled()) return;
|
||||
World world = Bukkit.getWorld("arrakis");
|
||||
if (world == null || world.getPlayers().isEmpty()) return;
|
||||
int count = 0;
|
||||
|
|
@ -173,16 +213,20 @@ final class Smugglers implements Listener {
|
|||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = false) public void interact(PlayerInteractEntityEvent event) {
|
||||
if (!tagged(event.getRightClicked())) return;
|
||||
Entity contact = event.getRightClicked();
|
||||
if (!contractContact(contact) || fixedContracts() && ESMAR.equals(fixedRole(contact))) return;
|
||||
event.setCancelled(true);
|
||||
if (!plugin.getConfig().getBoolean("smugglers.enabled", true)) return;
|
||||
if (event.getHand() != EquipmentSlot.HAND) return;
|
||||
Player player = event.getPlayer();
|
||||
if (sanctioned(player)) {
|
||||
player.sendMessage(ChatColor.GOLD + "Smuggler: 'The Emperor's seal is on your house. I won't risk my routes for an Imperial agent. Sell through your charter: /duneess sell pays +33% before the Trust levy.'");
|
||||
return;
|
||||
}
|
||||
open(player, event.getRightClicked());
|
||||
if(fixedContracts() && !contracts.containsKey(player.getUniqueId())){
|
||||
player.sendMessage("Start a delivery contract with Esmar Tuek first.");
|
||||
return;
|
||||
}
|
||||
open(player, contact);
|
||||
}
|
||||
private ItemStack icon(Material type, String title, String... lines) {
|
||||
ItemStack item = new ItemStack(type);
|
||||
|
|
@ -235,16 +279,19 @@ final class Smugglers implements Listener {
|
|||
if (!player.isOnline()) return;
|
||||
player.closeInventory();
|
||||
expireContracts();
|
||||
if (!plugin.getConfig().getBoolean("smugglers.enabled", true)) return;
|
||||
if (sanctioned(player)) { player.sendMessage(ChatColor.RED + "Imperial sanction: smuggling contracts are unavailable."); return; }
|
||||
Entity trader = com.dunerealms.npc.CitizensBridge.resolve(menu.trader);
|
||||
if (trader == null || !trader.isValid() || !tagged(trader)
|
||||
if (trader == null || !trader.isValid() || !contractContact(trader)
|
||||
|| !trader.getWorld().getName().equalsIgnoreCase("arrakis") || player.getWorld() != trader.getWorld()
|
||||
|| player.getLocation().distanceSquared(trader.getLocation()) > 64) {
|
||||
player.sendMessage(ChatColor.RED + "Return to the smuggler to trade."); return;
|
||||
}
|
||||
Contract active = contracts.get(player.getUniqueId());
|
||||
if (active == null && (slot == 11 || slot == 15)) {
|
||||
if(fixedContracts() && !fixedPairReady(trader)) {
|
||||
player.sendMessage("Both fixed delivery contacts must be available before starting a contract.");
|
||||
return;
|
||||
}
|
||||
contracts.put(player.getUniqueId(), offer(slot == 11 ? "spice" : "water", trader));
|
||||
if (!save()) { contracts.remove(player.getUniqueId()); player.sendMessage("Contract could not be saved. Try again."); return; }
|
||||
updateCamps();
|
||||
|
|
@ -253,7 +300,7 @@ final class Smugglers implements Listener {
|
|||
? "Smuggler: 'The melange must vanish from the Imperial ledger. My distant contact will pay for your silence.'"
|
||||
: "Smuggler: 'The hidden sietch has no water to spare. Reach my distant contact, and its people will remember.'"));
|
||||
player.sendMessage("Carry the cargo to another smuggler 64+ blocks from here. /dune smuggle status shows your contract.");
|
||||
player.sendMessage("You have 30 real minutes, including offline time. Your contact will wait at this lit camp until the contract ends.");
|
||||
player.sendMessage(fixedContracts()?"You have 30 real minutes. Deliver to Staban Tuek.":"You have 30 real minutes, including offline time. Your contact will wait at this lit camp until the contract ends.");
|
||||
} else if (active != null && slot == 22) {
|
||||
contracts.remove(player.getUniqueId());
|
||||
if (!save()) contracts.put(player.getUniqueId(), active);
|
||||
|
|
@ -316,8 +363,16 @@ final class Smugglers implements Listener {
|
|||
}
|
||||
void command(Player player, String[] args) {
|
||||
expireContracts();
|
||||
if(args.length>1&&args[1].equalsIgnoreCase("contract")){
|
||||
LivingEntity esmar=fixedContracts()?fixedContact(player.getWorld(),ESMAR):null;
|
||||
if(esmar==null||player.getLocation().distanceSquared(esmar.getLocation())>64){player.sendMessage("Meet Esmar Tuek on Arrakis to open fixed delivery contracts.");return;}
|
||||
if(sanctioned(player)){player.sendMessage("Imperial sanction: smuggling contracts are unavailable.");return;}
|
||||
if(!fixedPairReady(esmar)&&!contracts.containsKey(player.getUniqueId())){player.sendMessage("Both fixed contacts must be available first.");return;}
|
||||
open(player,esmar);
|
||||
return;
|
||||
}
|
||||
Contract contract = contracts.get(player.getUniqueId());
|
||||
if (contract == null) { player.sendMessage("No smuggling contract. Seek a roaming Arrakis Smuggler."); return; }
|
||||
if (contract == null) { player.sendMessage(fixedContracts()?"No smuggling contract. Meet Esmar Tuek on Arrakis.":"No smuggling contract. Seek a roaming Arrakis Smuggler."); return; }
|
||||
if (args.length > 1 && args[1].equalsIgnoreCase("cancel")) {
|
||||
contracts.remove(player.getUniqueId());
|
||||
if (!save()) contracts.put(player.getUniqueId(), contract);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
guild-npc:
|
||||
enabled: true
|
||||
smugglers:
|
||||
fixed-contracts:
|
||||
enabled: false
|
||||
enabled: true
|
||||
max-traders: 6
|
||||
spice-amount: 64
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ version: 1.0.0
|
|||
main: com.example.dunenpc.DuneNPC
|
||||
api-version: '1.21'
|
||||
depend: [DuneCore, DuneEss, Vault]
|
||||
softdepend: [Citizens, Citizens, DuneTerrain]
|
||||
softdepend: [Citizens, DuneTerrain]
|
||||
description: Guild Navigators, roaming smugglers, timed missions and quest camps
|
||||
commands:
|
||||
dunenpc:
|
||||
|
|
|
|||
|
|
@ -15,6 +15,37 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||
import static org.mockito.Mockito.*;
|
||||
|
||||
class CitizensBridgeTest {
|
||||
@Test void aPublishedButUnloadedRegistryCannotAcceptMutations() throws Exception {
|
||||
try (var bukkit = mockStatic(Bukkit.class)) {
|
||||
var manager = mock(PluginManager.class);
|
||||
var citizens = mock(JavaPlugin.class);
|
||||
var replacement = mock(JavaPlugin.class);
|
||||
bukkit.when(Bukkit::getPluginManager).thenReturn(manager);
|
||||
when(manager.getPlugin("Citizens")).thenReturn(citizens);
|
||||
when(citizens.isEnabled()).thenReturn(true);
|
||||
CitizensAPI.registry = mock(NPCRegistry.class);
|
||||
var loaded = CitizensBridge.class.getDeclaredField("loadedCitizens");
|
||||
loaded.setAccessible(true);
|
||||
try {
|
||||
assertFalse(CitizensBridge.ready());
|
||||
loaded.set(null, citizens);
|
||||
assertTrue(CitizensBridge.ready());
|
||||
when(manager.getPlugin("Citizens")).thenReturn(replacement);
|
||||
assertFalse(CitizensBridge.ready());
|
||||
} finally {
|
||||
loaded.set(null, null);
|
||||
CitizensAPI.registry = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test void fixedQuestRoleMatchesMetadataEvenWithLegacySmugglerMarker() throws Exception {
|
||||
var marker = new NamespacedKey("dunerealms", "quest_character");
|
||||
String stored = "dunecore\\:smuggler=b:1\n" + "dunerealms\\:quest_character=s:esmar_tuek\n";
|
||||
assertEquals(true, CitizensBridge.matchesMarker(stored, marker, "esmar_tuek"));
|
||||
assertEquals(false, CitizensBridge.matchesMarker(stored, marker, "staban_tuek"));
|
||||
}
|
||||
|
||||
@Test void conversionPersistsExistingBackendMarkersBeforeRetiringOldBody() throws Exception {
|
||||
conversion(true);
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue

Staff