Cover terrain service NPCs and fix Citizens test imports
This commit is contained in:
parent
dbf4bb25ff
commit
b11145bfbb
8 changed files with 1161 additions and 1125 deletions
|
|
@ -1,64 +1,65 @@
|
|||
name: DuneRealms Plugin CI
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- '.forgejo/workflows/plugins.yml'
|
||||
- 'Dune*/**'
|
||||
- 'JarvisConnector/**'
|
||||
- 'gui-common/**'
|
||||
- 'citizens-common/**'
|
||||
- 'network/resource-pack/shared/**'
|
||||
- 'network/content-assets/planet-artwork/profiles.json'
|
||||
- 'tools/*gameplay*'
|
||||
|
||||
jobs:
|
||||
plugins:
|
||||
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: Test and build first-party plugins
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
modules=(DuneEss DuneLobby DuneNPC DuneRealms-minecraft-only DuneRealmsGUI DuneTerrain JarvisConnector)
|
||||
mkdir -p plugin-artifacts
|
||||
for module in "${modules[@]}"; do
|
||||
gradle --no-daemon -p "$module" test jar
|
||||
for jar in "$module"/build/libs/*.jar; do
|
||||
test -f "$jar"
|
||||
artifact="plugin-artifacts/${jar##*/}"
|
||||
test ! -e "$artifact"
|
||||
cp "$jar" "$artifact"
|
||||
done
|
||||
done
|
||||
printf '%s\n' "$(git rev-parse HEAD)" > plugin-artifacts/SOURCE_COMMIT
|
||||
(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
|
||||
with:
|
||||
name: DuneRealms-Plugins
|
||||
path: plugin-artifacts/
|
||||
if-no-files-found: error
|
||||
name: DuneRealms Plugin CI
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- '.forgejo/workflows/plugins.yml'
|
||||
- 'Dune*/**'
|
||||
- 'JarvisConnector/**'
|
||||
- 'gui-common/**'
|
||||
- 'citizens-common/**'
|
||||
- 'network/resource-pack/shared/**'
|
||||
- 'network/content-assets/planet-artwork/profiles.json'
|
||||
- 'tools/*gameplay*'
|
||||
|
||||
jobs:
|
||||
plugins:
|
||||
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: Test and build first-party plugins
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
modules=(DuneEss DuneLobby DuneNPC DuneRealms-minecraft-only DuneRealmsGUI DuneTerrain JarvisConnector)
|
||||
mkdir -p plugin-artifacts
|
||||
for module in "${modules[@]}"; do
|
||||
gradle --no-daemon -p "$module" test jar
|
||||
for jar in "$module"/build/libs/*.jar; do
|
||||
test -f "$jar"
|
||||
artifact="plugin-artifacts/${jar##*/}"
|
||||
test ! -e "$artifact"
|
||||
cp "$jar" "$artifact"
|
||||
done
|
||||
done
|
||||
printf '%s\n' "$(git rev-parse HEAD)" > plugin-artifacts/SOURCE_COMMIT
|
||||
(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"
|
||||
python3 tools/write-plugin-manifest.py plugin-artifacts "$GITHUB_SHA"
|
||||
(cd plugin-artifacts && sha256sum -- *.jar *.zip *.json SOURCE_COMMIT > SHA256SUMS)
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DuneRealms-Plugins
|
||||
path: plugin-artifacts/
|
||||
if-no-files-found: error
|
||||
|
|
|
|||
|
|
@ -1,71 +1,72 @@
|
|||
name: DuneRealms Resourcepack CI
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
name: DuneRealms Resourcepack CI
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'DuneRealmsGUI/**'
|
||||
- 'network/resource-pack/shared/**'
|
||||
- 'tools/*gameplay*'
|
||||
- 'tools/build-resourcepack-repair.py'
|
||||
- 'tools/test_resourcepack_repair.py'
|
||||
- 'tools/build-arrakis-fauna-pack.mjs'
|
||||
- 'tools/build-fauna-models.mjs'
|
||||
- 'tools/build-fauna-pack-update.py'
|
||||
- 'tools/test_fauna_pack_update.py'
|
||||
- 'DuneTerrain/**'
|
||||
- 'DuneRealms-minecraft-only/**'
|
||||
- 'JarvisConnector/**'
|
||||
- '.forgejo/workflows/resourcepack-ci.yml'
|
||||
jobs:
|
||||
resourcepack:
|
||||
runs-on: dune-ci
|
||||
steps:
|
||||
- name: Checkout exact reviewed revision
|
||||
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/plugins.git "$GITHUB_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- name: Build immutable repair archives and verify pinned inputs
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p resourcepack-baselines resourcepack-output
|
||||
curl --fail --location --retry 2 https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v3.zip -o resourcepack-baselines/DuneRealms-Network-Artwork-v3.zip
|
||||
curl --fail --location --retry 2 https://www.dunerealms.com/downloads/DuneRealms-Materials-arrakis-v4.zip -o resourcepack-baselines/DuneRealms-Materials-arrakis-v4.zip
|
||||
DUNE_REPAIR_BASELINE_DIR="$PWD/resourcepack-baselines" python3 tools/test_resourcepack_repair.py -v
|
||||
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
|
||||
python3 tools/build-fauna-pack-update.py resourcepack-output resourcepack-output/fauna-preview
|
||||
- 'tools/*gameplay*'
|
||||
- 'tools/build-resourcepack-repair.py'
|
||||
- 'tools/test_resourcepack_repair.py'
|
||||
- 'tools/build-arrakis-fauna-pack.mjs'
|
||||
- 'tools/build-fauna-models.mjs'
|
||||
- 'tools/build-fauna-pack-update.py'
|
||||
- 'tools/test_fauna_pack_update.py'
|
||||
- 'DuneTerrain/**'
|
||||
- 'DuneRealms-minecraft-only/**'
|
||||
- 'JarvisConnector/**'
|
||||
- '.forgejo/workflows/resourcepack-ci.yml'
|
||||
jobs:
|
||||
resourcepack:
|
||||
runs-on: dune-ci
|
||||
steps:
|
||||
- name: Checkout exact reviewed revision
|
||||
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/plugins.git "$GITHUB_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- name: Build immutable repair archives and verify pinned inputs
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p resourcepack-baselines resourcepack-output
|
||||
curl --fail --location --retry 2 https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v3.zip -o resourcepack-baselines/DuneRealms-Network-Artwork-v3.zip
|
||||
curl --fail --location --retry 2 https://www.dunerealms.com/downloads/DuneRealms-Materials-arrakis-v4.zip -o resourcepack-baselines/DuneRealms-Materials-arrakis-v4.zip
|
||||
DUNE_REPAIR_BASELINE_DIR="$PWD/resourcepack-baselines" python3 tools/test_resourcepack_repair.py -v
|
||||
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
|
||||
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
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- name: Install Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
gradle-version: '9.2.1'
|
||||
- name: Build and test pack delivery plugin
|
||||
run: |
|
||||
gradle --no-daemon -p DuneRealmsGUI test jar
|
||||
gradle --no-daemon -p DuneTerrain test jar
|
||||
gradle --no-daemon -p DuneRealms-minecraft-only test jar
|
||||
gradle --no-daemon -p JarvisConnector test jar
|
||||
- name: Upload reviewed packs and GUI plugin
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DuneRealms-Resourcepack-Repair
|
||||
path: |
|
||||
resourcepack-output/
|
||||
DuneRealmsGUI/build/libs/DunerealmsGUI.jar
|
||||
DuneTerrain/build/libs/DuneRealms-Terrain.jar
|
||||
DuneRealms-minecraft-only/build/libs/DuneRealms-Core.jar
|
||||
JarvisConnector/build/libs/jarvistranslator.jar
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
- name: Install Java 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- name: Install Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
gradle-version: '9.2.1'
|
||||
- name: Build and test pack delivery plugin
|
||||
run: |
|
||||
gradle --no-daemon -p DuneRealmsGUI test jar
|
||||
gradle --no-daemon -p DuneTerrain test jar
|
||||
gradle --no-daemon -p DuneRealms-minecraft-only test jar
|
||||
gradle --no-daemon -p JarvisConnector test jar
|
||||
- name: Upload reviewed packs and GUI plugin
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DuneRealms-Resourcepack-Repair
|
||||
path: |
|
||||
resourcepack-output/
|
||||
DuneRealmsGUI/build/libs/DunerealmsGUI.jar
|
||||
DuneTerrain/build/libs/DuneRealms-Terrain.jar
|
||||
DuneRealms-minecraft-only/build/libs/DuneRealms-Core.jar
|
||||
JarvisConnector/build/libs/jarvistranslator.jar
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.bukkit.plugin.PluginManager;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.npc.*;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
|
|
|||
|
|
@ -1,35 +1,37 @@
|
|||
plugins { java }
|
||||
plugins { java }
|
||||
|
||||
group = "com.example"
|
||||
version = "1.0.13-worlds1"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
|
||||
testImplementation("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
|
||||
testImplementation("org.mockito:mockito-core:5.15.2")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.11.4")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
java { toolchain.languageVersion.set(JavaLanguageVersion.of(21)) }
|
||||
tasks.jar { archiveBaseName.set("DuneTerrain") }
|
||||
tasks.withType<JavaCompile> { options.encoding = "UTF-8" }
|
||||
tasks.test { useJUnitPlatform() }
|
||||
|
||||
tasks.jar { archiveFileName.set("DuneRealms-Terrain.jar") }
|
||||
|
||||
val highlandsDatapack by tasks.registering(Zip::class) {
|
||||
from("highlands-datapack")
|
||||
archiveFileName.set("DuneRealms-Dune-Highlands-Datapack.zip")
|
||||
destinationDirectory.set(layout.buildDirectory.dir("distributions"))
|
||||
}
|
||||
tasks.assemble { dependsOn(highlandsDatapack) }
|
||||
|
||||
val mockitoAgent by configurations.creating
|
||||
dependencies { mockitoAgent("org.mockito:mockito-core:5.15.2") { isTransitive = false } }
|
||||
tasks.test { jvmArgs("-javaagent:${mockitoAgent.singleFile.absolutePath}") }
|
||||
|
||||
group = "com.example"
|
||||
version = "1.0.13-worlds1"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
|
||||
testImplementation("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
|
||||
testImplementation("org.mockito:mockito-core:5.15.2")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.11.4")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
java { toolchain.languageVersion.set(JavaLanguageVersion.of(21)) }
|
||||
tasks.jar { archiveBaseName.set("DuneTerrain") }
|
||||
tasks.withType<JavaCompile> { options.encoding = "UTF-8" }
|
||||
tasks.test { useJUnitPlatform() }
|
||||
|
||||
tasks.jar { archiveFileName.set("DuneRealms-Terrain.jar") }
|
||||
|
||||
val highlandsDatapack by tasks.registering(Zip::class) {
|
||||
from("highlands-datapack")
|
||||
archiveFileName.set("DuneRealms-Dune-Highlands-Datapack.zip")
|
||||
destinationDirectory.set(layout.buildDirectory.dir("distributions"))
|
||||
}
|
||||
tasks.assemble { dependsOn(highlandsDatapack) }
|
||||
|
||||
val mockitoAgent by configurations.creating
|
||||
dependencies { mockitoAgent("org.mockito:mockito-core:5.15.2") { isTransitive = false } }
|
||||
tasks.test { jvmArgs("-javaagent:${mockitoAgent.singleFile.absolutePath}") }
|
||||
sourceSets.main { java.srcDir("../citizens-common/src/main/java") }
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +1,7 @@
|
|||
name: DuneTerrain
|
||||
version: 1.0.13-worlds1
|
||||
main: com.example.duneterrain.DuneTerrain
|
||||
api-version: '1.21'
|
||||
load: STARTUP
|
||||
description: Configurable Dune planet terrain and spawn generator for Paper
|
||||
softdepend: [DuneEss]
|
||||
name: DuneTerrain
|
||||
version: 1.0.13-worlds1
|
||||
main: com.example.duneterrain.DuneTerrain
|
||||
api-version: '1.21'
|
||||
load: STARTUP
|
||||
description: Configurable Dune planet terrain and spawn generator for Paper
|
||||
softdepend: [Citizens, DuneEss]
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ public final class CitizensBridge implements Listener {
|
|||
private void convert(LivingEntity legacy, Object registry) throws ReflectiveOperationException {
|
||||
var marker = keys.stream().sorted(Comparator.comparing(NamespacedKey::toString)).filter(key -> legacy.getPersistentDataContainer().has(key)).findFirst().orElseThrow();
|
||||
String markerValue = legacy.getPersistentDataContainer().has(marker, PersistentDataType.STRING) ? legacy.getPersistentDataContainer().get(marker, PersistentDataType.STRING) : null;
|
||||
boolean unique = marker.toString().equals("dunecore:smuggler");
|
||||
boolean unique = marker.toString().equals("dunecore:smuggler") || marker.toString().equals("dunerealms:spice-seller");
|
||||
String stable = plugin.getName() + ":" + legacy.getWorld().getUID() + ":" + marker + ":" + (unique ? identity(legacy) : markerValue == null ? "1" : markerValue);
|
||||
Object npc = null;
|
||||
for (Object candidate : (Iterable<?>) registry) if (stable.equals(read(candidate, "dr-id"))) { npc = candidate; break; }
|
||||
|
|
|
|||
31
tools/write-plugin-manifest.py
Normal file
31
tools/write-plugin-manifest.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"""Record versions and hashes from the actual built plugin JARs."""
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
|
||||
def manifest(folder, commit):
|
||||
plugins = []
|
||||
for path in sorted(Path(folder).glob('*.jar')):
|
||||
with zipfile.ZipFile(path) as jar:
|
||||
description = jar.read('plugin.yml').decode()
|
||||
fields = {}
|
||||
for key in ('name', 'version', 'main'):
|
||||
match = re.search(r'^' + key + r':\s*(.+?)\s*$', description, re.M)
|
||||
if not match:
|
||||
raise ValueError(f'Missing {key} in {path.name}')
|
||||
fields[key] = match.group(1).strip('"\'')
|
||||
plugins.append({**fields, 'filename': path.name,
|
||||
'sha256': hashlib.sha256(path.read_bytes()).hexdigest()})
|
||||
if not plugins:
|
||||
raise ValueError('No plugin artifacts')
|
||||
result = {'sourceCommit': commit, 'plugins': plugins}
|
||||
(Path(folder) / 'release-manifest.json').write_text(json.dumps(result, indent=2) + '\n')
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(json.dumps(manifest(sys.argv[1], sys.argv[2]), indent=2))
|
||||
Loading…
Reference in a new issue

Staff