Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4bc296ce1 | ||
|
|
7edfe71d2d |
No files matched your search
@@ -13,6 +13,6 @@ while IFS='=' read -r key value && [ -n "$key" ]; do
|
||||
done
|
||||
[ "$protocol" = https ] || exit 0
|
||||
[ "$host" = git.garvis.dev ] || exit 0
|
||||
[ "$path" = dmg/spigot-ignis.git ] || exit 0
|
||||
[ "$path" = dmg/purpur-ignis.git ] || exit 0
|
||||
[ -n "${IGNIS_RELEASE_TOKEN:-}" ] || exit 0
|
||||
printf 'username=dmg\npassword=%s\n\n' "$IGNIS_RELEASE_TOKEN"
|
||||
@@ -35,6 +35,6 @@ jobs:
|
||||
- name: Upload development artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: spigot-ignis-${{ github.sha }}
|
||||
name: purpur-ignis-${{ github.sha }}
|
||||
path: build/libs/*.jar
|
||||
if-no-files-found: error
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
set -euo pipefail
|
||||
test -n "$IGNIS_RELEASE_TOKEN" || { echo 'RELEASE_TOKEN is required'; exit 1; }
|
||||
test "$GITEA_SERVER_URL" = 'https://git.garvis.dev'
|
||||
test "$REPOSITORY" = 'dmg/spigot-ignis'
|
||||
test "$REPOSITORY" = 'dmg/purpur-ignis'
|
||||
# semantic-release overrides GIT_ASKPASS; use Git's credential protocol instead.
|
||||
# Token stays in environment/credential stdout, never in the remote URL or argv.
|
||||
export GIT_TERMINAL_PROMPT=0
|
||||
@@ -85,8 +85,8 @@ jobs:
|
||||
if: steps.release.outputs.created == 'true'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: spigot-ignis-${{ steps.release.outputs.version }}
|
||||
path: build/libs/spigot-ignis-${{ steps.release.outputs.version }}.jar
|
||||
name: purpur-ignis-${{ steps.release.outputs.version }}
|
||||
path: build/libs/purpur-ignis-${{ steps.release.outputs.version }}.jar
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Publish versioned Gitea asset
|
||||
@@ -102,9 +102,9 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test "$GITEA_SERVER_URL" = 'https://git.garvis.dev'
|
||||
test "$REPOSITORY" = 'dmg/spigot-ignis'
|
||||
test "$REPOSITORY" = 'dmg/purpur-ignis'
|
||||
api_url="${GITEA_SERVER_URL}/api/v1/repos/${REPOSITORY}/releases"
|
||||
jar="build/libs/spigot-ignis-${VERSION}.jar"
|
||||
jar="build/libs/purpur-ignis-${VERSION}.jar"
|
||||
payload=$(mktemp)
|
||||
response=$(mktemp)
|
||||
trap 'rm -f "$payload" "$response"' EXIT
|
||||
@@ -127,4 +127,4 @@ jobs:
|
||||
curl --fail --silent --show-error --max-time 120 --proto '=https' \
|
||||
--header @- --header 'Content-Type: application/octet-stream' \
|
||||
--data-binary "@$jar" --output /dev/null \
|
||||
"${api_url}/${release_id}/assets?name=spigot-ignis-${VERSION}.jar"
|
||||
"${api_url}/${release_id}/assets?name=purpur-ignis-${VERSION}.jar"
|
||||
@@ -1,8 +1,8 @@
|
||||
# Spigot Ignis agent entrypoint
|
||||
# Purpur Ignis agent entrypoint
|
||||
|
||||
The canonical knowledge bundle is the sibling `../somc-okf/` repository, remotely at https://git.garvis.dev/dmg/somc-okf/src/branch/main/index.md.
|
||||
|
||||
Before changes read its root index, `processes/development.md`, `runbooks/development-cycle.md`, `projects/spigot-ignis/index.md`, `projects/spigot-ignis/engineering.md`, and the relevant `user-stories/spigot-ignis/` documents. Follow the parent workspace instructions. Do not create a local knowledge/design bundle.
|
||||
Before changes read its root index, `processes/development.md`, `runbooks/development-cycle.md`, `projects/purpur-ignis/index.md`, `projects/purpur-ignis/engineering.md`, and the relevant `user-stories/purpur-ignis/` documents. Follow the parent workspace instructions. Do not create a local knowledge/design bundle.
|
||||
|
||||
Use Java 25 and the declared Purpur API. Test behavior first with meaningful failures, implement minimally, then run `./gradlew clean check jar`. Never mark server/client behavior verified through domain tests alone.
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# Spigot Ignis
|
||||
# Purpur Ignis
|
||||
|
||||
Server-wide earned shadow progression for Social Minecraft. **Echo of the Abyss, advancement-name scrambling, The Mask, The Dagger, and The Heart of Shadows are implemented in source; live-server/client verification is pending.**
|
||||
|
||||
The repository, checkout and new artifacts use `purpur-ignis`. Runtime `SpigotIgnis`, Java packages/entrypoint, `plugins/SpigotIgnis/state.bin`, all `spigotignis:` item/recipe/provenance keys and existing gameplay are retained. Replace the old JAR rather than installing both distributions. Old tags/assets remain available. This rename does not close known Echo consumption/recovery gaps.
|
||||
|
||||
## Build
|
||||
|
||||
Requires Java 17+ to launch Gradle; the wrapper resolves a Java 25 toolchain for compilation/testing. Toolchain downloads require network access when no compatible cache is available.
|
||||
@@ -11,13 +13,13 @@ Requires Java 17+ to launch Gradle; the wrapper resolves a Java 25 toolchain for
|
||||
./gradlew clean jar -PreleaseVersion=0.1.0
|
||||
```
|
||||
|
||||
Targets Purpur `26.2.build.2618-stable` and requires **ProtocolLib 5.4.0** for Mask helmet projection. Neither server API nor ProtocolLib is bundled. Source builds do not require the private wiki.
|
||||
The runtime requires Java 25. New JARs are `build/libs/purpur-ignis-<version>.jar`. Targets Purpur `26.2.build.2618-stable` and requires **ProtocolLib 5.4.0** for Mask helmet projection. Neither server API nor ProtocolLib is bundled. Source builds do not require the private wiki.
|
||||
|
||||
## Knowledge and delivery
|
||||
|
||||
The [canonical project](https://git.garvis.dev/dmg/somc-okf/src/branch/main/projects/spigot-ignis/index.md) and stories live in the shared private SoMC wiki. There is no repository-local knowledge bundle.
|
||||
The [canonical project](https://git.garvis.dev/dmg/somc-okf/src/branch/main/projects/purpur-ignis/index.md) and stories live in the shared private SoMC wiki. There is no repository-local knowledge bundle.
|
||||
|
||||
CI/release workflows publish versioned source artifacts; verify their exact run/commit before using any artifact. Release publication requires the repository Actions secret `RELEASE_TOKEN`, provisioned separately. The release workflow uses a repository-scoped Git credential helper and curl stdin for authentication rather than embedding a release credential in URLs or process arguments. Semantic-release overrides `GIT_ASKPASS`, so askpass is not used for release authentication. Never enable tracing. GitOps and production release need separate approvals.
|
||||
CI/release workflows publish versioned source artifacts; verify their exact run/commit before using any artifact. Release publication requires the repository Actions secret `RELEASE_TOKEN`, provisioned separately. The release workflow uses a Git credential helper scoped exclusively to `https://git.garvis.dev/dmg/purpur-ignis.git` and curl stdin for authentication rather than embedding a release credential in URLs or process arguments. Semantic-release overrides `GIT_ASKPASS`, so askpass is not used for release authentication. Never enable tracing. GitOps and production release need separate approvals.
|
||||
|
||||
## Foundation interfaces and state
|
||||
|
||||
@@ -102,6 +104,8 @@ Administration requires **`ignis.admin`** (default: operators), checked independ
|
||||
/ignisadmin reset <online-name|known-UUID> <void|mask|dagger|heart|all> confirm
|
||||
```
|
||||
|
||||
`inspect` reports saved progress for all four tracks (Mask/Heart milliseconds and Dagger pearls), pending/issued reward counts, recipe unlock eligibility, and Echo eligibility separately from permanent advancement-name-scrambling activation. It also reports the active void attempt: `awaiting-elytra-ascent`, `awaiting-end-stone`, or `none`, including world UUID and original damage height when active. Inspection is read-only: it does not checkpoint progress, advance/cancel challenges, deliver items or write state. Counters exclude uncommitted tracker time; recipe unlocks do not mean item effects are currently equipped or active. Known offline UUIDs remain inspectable; unfinished void attempts are not restored after disconnect/restart.
|
||||
|
||||
Reset confirmation must match the same sender, target, and tracks within 30 seconds; `confirm` alone cannot bypass the initial request. Reset clears the selected progress/unlocks/activation, pending rewards and issuance receipts, and advances generation, making old Echo copies invalid even after re-earning. Other tracks are unchanged by a single-track reset. Echo grants unlock eligibility but still require consumption to activate scrambling; already activated players do not gain another activation. Admin Mask/Dagger grants unlock use and queue authenticated items for inventory-ready delivery; new Masks also require profile resolution. Mask/Dagger delivery retries remember an already offered gift while its acknowledgement save is failing, so trading it away does not cause another offer in the same plugin session. This marker is not durable across process restart; failed-acknowledgement/restart recovery still requires operator review. Admin mutations are audited, not routine private progress reads.
|
||||
|
||||
Offline targets use UUIDs already present in Ignis state; online exact names are resolved without network profile lookups. Commands and contextual completion do not claim that unimplemented reward items are available.
|
||||
|
||||
+6
-1
@@ -24,7 +24,12 @@ dependencies {
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
tasks.test { useJUnitPlatform() }
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
dependsOn(tasks.jar)
|
||||
systemProperty("distribution.jar", tasks.jar.get().archiveFile.get().asFile.absolutePath)
|
||||
systemProperty("distribution.version", project.version.toString())
|
||||
}
|
||||
val pluginVersion = version
|
||||
tasks.processResources {
|
||||
filesMatching("plugin.yml") { expand("version" to pluginVersion) }
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" }
|
||||
rootProject.name = "spigot-ignis"
|
||||
rootProject.name = "purpur-ignis"
|
||||
@@ -76,6 +76,11 @@ public final class EchoGameplay implements Listener {
|
||||
@EventHandler public void onQuit(PlayerQuitEvent event) { cancel(event.getPlayer().getUniqueId()); }
|
||||
public void cancel(UUID player) { trial.cancel(player); }
|
||||
|
||||
/** Read-only server-thread inspection; does not advance, cancel or persist the attempt. */
|
||||
public java.util.Optional<VoidTrial.Snapshot> trialSnapshot(UUID player) {
|
||||
return trial.snapshot(player);
|
||||
}
|
||||
|
||||
public boolean activated(UUID player) {
|
||||
return states.snapshot().players().getOrDefault(player, PlayerState.empty()).track(Track.VOID).activated();
|
||||
}
|
||||
|
||||
@@ -69,8 +69,19 @@ public final class IgnisCommands implements CommandExecutor, TabCompleter {
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("inspect")) {
|
||||
UUID id = resolve(args[1]);
|
||||
var player = states.snapshot().players().getOrDefault(id, PlayerState.empty());
|
||||
sender.sendMessage(id + ": " + player.tracks() + "; pending=" + player.pendingRewards().size()
|
||||
+ "; issued=" + player.issuedRewards().size());
|
||||
String progress = java.util.Arrays.stream(Track.values())
|
||||
.map(track -> track + "=" + player.track(track).progress())
|
||||
.collect(java.util.stream.Collectors.joining(", "));
|
||||
sender.sendMessage(id + ": saved progress (MASK/HEART milliseconds, DAGGER pearls): " + progress
|
||||
+ "; pending=" + player.pendingRewards().size() + "; issued=" + player.issuedRewards().size());
|
||||
sender.sendMessage("Recipe unlocks: mask=" + status(player, Track.MASK)
|
||||
+ ", dagger=" + status(player, Track.DAGGER) + ", heart=" + status(player, Track.HEART));
|
||||
sender.sendMessage("Echo: eligibility=" + status(player, Track.VOID) + "; advancement-name scrambling="
|
||||
+ (player.track(Track.VOID).activated() ? "active" : "inactive"));
|
||||
sender.sendMessage("Void challenge: " + gameplay.trialSnapshot(id)
|
||||
.map(attempt -> (attempt.escaped() ? "awaiting-end-stone" : "awaiting-elytra-ascent")
|
||||
+ "; world=" + attempt.world() + "; damage-y=" + attempt.damageHeight())
|
||||
.orElse("none"));
|
||||
} else if (args.length == 1 && args[0].equalsIgnoreCase("limits")) {
|
||||
sender.sendMessage(states.snapshot().limits().toString());
|
||||
} else if (args.length == 4 && args[0].equalsIgnoreCase("limits") && args[1].equalsIgnoreCase("set")) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.UUID;
|
||||
|
||||
/** Server-thread transient attempts. Never persisted across disconnect/restart. */
|
||||
public final class VoidTrial {
|
||||
public record Snapshot(UUID world, double damageHeight, boolean escaped) { }
|
||||
private record Attempt(UUID world, double damageHeight, boolean escaped) { }
|
||||
private final Map<UUID, Attempt> attempts = new HashMap<>();
|
||||
|
||||
@@ -30,5 +31,12 @@ public final class VoidTrial {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Server-thread read only: never advances, cancels or persists an attempt. */
|
||||
public java.util.Optional<Snapshot> snapshot(UUID player) {
|
||||
Attempt attempt = attempts.get(player);
|
||||
return attempt == null ? java.util.Optional.empty()
|
||||
: java.util.Optional.of(new Snapshot(attempt.world(), attempt.damageHeight(), attempt.escaped()));
|
||||
}
|
||||
|
||||
public void cancel(UUID player) { attempts.remove(player); }
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package games.dmg.spigotignis;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
class ProgressInspectionTest {
|
||||
@TempDir Path directory;
|
||||
private final UUID owner = UUID.randomUUID(), worldId = UUID.randomUUID();
|
||||
private final JavaPlugin plugin = mock(JavaPlugin.class);
|
||||
private final Server server = mock(Server.class);
|
||||
private final Player player = mock(Player.class);
|
||||
private final World world = mock(World.class);
|
||||
private final CommandSender admin = mock(CommandSender.class);
|
||||
private final Command command = mock(Command.class);
|
||||
private final EchoItems items = mock(EchoItems.class);
|
||||
private final List<String> messages = new ArrayList<>();
|
||||
private StateService states;
|
||||
private EchoGameplay gameplay;
|
||||
private IgnisCommands handler;
|
||||
private Path file;
|
||||
|
||||
@BeforeEach
|
||||
void setup() throws Exception {
|
||||
file = directory.resolve("state.bin");
|
||||
states = StateService.open(new FileStateRepository(file)).get();
|
||||
states.update(state -> new IgnisState(state.limits(), Map.of(owner, PlayerState.empty()))).get();
|
||||
when(plugin.getServer()).thenReturn(server);
|
||||
when(player.getUniqueId()).thenReturn(owner);
|
||||
when(player.getName()).thenReturn("Target");
|
||||
when(player.getWorld()).thenReturn(world);
|
||||
when(player.getY()).thenReturn(-65.0);
|
||||
when(world.getUID()).thenReturn(worldId);
|
||||
when(server.getPlayerExact("Target")).thenReturn(player);
|
||||
when(admin.hasPermission("ignis.admin")).thenReturn(true);
|
||||
when(command.getName()).thenReturn("ignisadmin");
|
||||
doAnswer(call -> { messages.add(call.getArgument(0, String.class)); return null; })
|
||||
.when(admin).sendMessage(anyString());
|
||||
gameplay = new EchoGameplay(plugin, states, items);
|
||||
handler = new IgnisCommands(plugin, states, gameplay);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void close() { if (states != null) states.close(); }
|
||||
|
||||
@Test
|
||||
void commandReportsRealGameplayAttemptStagesWithoutSavingOrInterruptingThem() throws Exception {
|
||||
var before = states.snapshot();
|
||||
byte[] bytes = Files.readAllBytes(file);
|
||||
EntityDamageEvent damage = mock(EntityDamageEvent.class);
|
||||
when(damage.getEntity()).thenReturn(player);
|
||||
when(damage.getCause()).thenReturn(EntityDamageEvent.DamageCause.VOID);
|
||||
when(damage.getFinalDamage()).thenReturn(1.0);
|
||||
gameplay.onDamage(damage);
|
||||
inspect("Target");
|
||||
assertContains("Void challenge: awaiting-elytra-ascent");
|
||||
assertContains("world=" + worldId);
|
||||
assertContains("damage-y=-65.0");
|
||||
when(player.isGliding()).thenReturn(true);
|
||||
gameplay.onMove(new PlayerMoveEvent(player, new Location(world, 0, -65, 0), new Location(world, 0, 20, 0)));
|
||||
messages.clear();
|
||||
inspect("Target");
|
||||
assertContains("Void challenge: awaiting-end-stone");
|
||||
var quit = mock(PlayerQuitEvent.class);
|
||||
when(quit.getPlayer()).thenReturn(player);
|
||||
gameplay.onQuit(quit);
|
||||
messages.clear();
|
||||
inspect(owner.toString());
|
||||
assertContains("Void challenge: none");
|
||||
assertSame(before, states.snapshot());
|
||||
assertArrayEquals(bytes, Files.readAllBytes(file));
|
||||
verifyNoInteractions(items);
|
||||
verify(plugin, never()).getLogger();
|
||||
verify(server, never()).getScheduler();
|
||||
}
|
||||
|
||||
@Test
|
||||
void savedProgressAndRecipeUnlocksDoNotMisreportAnUnconsumedEchoAsActive() throws Exception {
|
||||
UUID receipt = UUID.randomUUID();
|
||||
states.update(state -> EchoRewards.award(ProgressAdministration.progress(
|
||||
ProgressAdministration.progress(state, owner, Track.MASK, state.limits().invisibilityMillis(), false),
|
||||
owner, Track.DAGGER, 3, false), owner, receipt)).get();
|
||||
var before = states.snapshot();
|
||||
byte[] bytes = Files.readAllBytes(file);
|
||||
inspect(owner.toString());
|
||||
assertContains("MASK=" + before.limits().invisibilityMillis());
|
||||
assertContains("DAGGER=3");
|
||||
assertContains("HEART=0");
|
||||
assertContains("Recipe unlocks: mask=unlocked, dagger=locked, heart=locked");
|
||||
assertContains("Echo: eligibility=unlocked; advancement-name scrambling=inactive");
|
||||
assertContains("pending=1");
|
||||
assertContains("issued=1");
|
||||
assertSame(before, states.snapshot());
|
||||
assertArrayEquals(bytes, Files.readAllBytes(file));
|
||||
verify(server, never()).getPlayerExact(anyString());
|
||||
verifyNoInteractions(items);
|
||||
states.update(state -> EchoRewards.activate(state, owner, new EchoToken(owner, receipt, 0))).get();
|
||||
messages.clear();
|
||||
inspect(owner.toString());
|
||||
assertContains("advancement-name scrambling=active");
|
||||
}
|
||||
|
||||
@Test
|
||||
void nonAdminInspectionIsDeniedBeforeReadingOrResolvingState() {
|
||||
when(admin.hasPermission("ignis.admin")).thenReturn(false);
|
||||
var denied = new IgnisCommands(plugin, null, null);
|
||||
denied.onCommand(admin, command, "ignisadmin", new String[] {"inspect", "Target"});
|
||||
assertEquals(List.of("You do not have permission to administer Ignis."), messages);
|
||||
verifyNoInteractions(server);
|
||||
}
|
||||
|
||||
private void inspect(String target) {
|
||||
assertTrue(handler.onCommand(admin, command, "ignisadmin", new String[] {"inspect", target}));
|
||||
}
|
||||
|
||||
private void assertContains(String fragment) {
|
||||
assertTrue(messages.stream().anyMatch(message -> message.contains(fragment)),
|
||||
() -> "Missing '" + fragment + "' in " + messages);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package games.dmg.spigotignis;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
import java.util.jar.JarFile;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
class PurpurDistributionTest {
|
||||
@Test
|
||||
void packagesNewNameWithoutChangingRuntimeIdentityOrBundlingTheApi() throws Exception {
|
||||
Path artifact = Path.of(System.getProperty("distribution.jar"));
|
||||
String version = System.getProperty("distribution.version");
|
||||
assertEquals("purpur-ignis-" + version + ".jar", artifact.getFileName().toString());
|
||||
try (var jar = new JarFile(artifact.toFile())) {
|
||||
Map<?, ?> metadata = new Yaml().load(jar.getInputStream(jar.getJarEntry("plugin.yml")));
|
||||
assertEquals(version, metadata.get("version"));
|
||||
assertEquals("SpigotIgnis", metadata.get("name"), "Retain the data directory and persistent namespace");
|
||||
assertEquals("games.dmg.spigotignis.SpigotIgnisPlugin", metadata.get("main"));
|
||||
assertTrue(((Map<?, ?>) metadata.get("permissions")).containsKey("ignis.admin"));
|
||||
assertEquals(java.util.List.of("ProtocolLib"), metadata.get("depend"));
|
||||
var descriptor = new org.bukkit.plugin.PluginDescriptionFile(jar.getInputStream(jar.getJarEntry("plugin.yml")));
|
||||
assertEquals("spigotignis", descriptor.namespace());
|
||||
assertFalse(jar.stream().anyMatch(entry -> entry.getName().startsWith("org/bukkit/")
|
||||
|| entry.getName().startsWith("org/purpurmc/") || entry.getName().startsWith("com/comphenix/") || entry.getName().endsWith("Test.class")));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void pluginBytecodeTargetsJava25() throws Exception {
|
||||
try (var jar = new JarFile(System.getProperty("distribution.jar"));
|
||||
var bytecode = new DataInputStream(jar.getInputStream(
|
||||
jar.getJarEntry("games/dmg/spigotignis/SpigotIgnisPlugin.class")))) {
|
||||
assertEquals(0xCAFEBABE, bytecode.readInt());
|
||||
bytecode.readUnsignedShort();
|
||||
assertEquals(69, bytecode.readUnsignedShort());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void releaseAndCiAgreeWithThePurpurDistributionNameAndToolchain() throws Exception {
|
||||
String build = Files.readString(Path.of("build.gradle.kts"));
|
||||
assertTrue(build.contains("purpur-api:26.2.build.2618-stable"));
|
||||
assertFalse(build.contains("org.spigotmc:spigot-api"));
|
||||
for (String workflow : new String[] {"ci.yml", "release.yml"}) {
|
||||
String content = Files.readString(Path.of(".gitea/workflows", workflow));
|
||||
assertTrue(content.contains("java-version: 25"));
|
||||
assertTrue(content.contains("purpur-ignis-"), workflow);
|
||||
assertFalse(content.contains("spigot-ignis-"), workflow);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,9 @@ class ReleaseCredentialTest {
|
||||
void credentialHelperRefusesOtherHostsProtocolsRepositoriesAndOperations() throws Exception {
|
||||
Path helper = Path.of(".gitea/scripts/git-credential-ignis.sh").toAbsolutePath();
|
||||
for (String request : java.util.List.of(
|
||||
"protocol=https\nhost=evil.example\npath=dmg/spigot-ignis.git\n\n",
|
||||
"protocol=http\nhost=git.garvis.dev\npath=dmg/spigot-ignis.git\n\n",
|
||||
"protocol=https\nhost=evil.example\npath=dmg/purpur-ignis.git\n\n",
|
||||
"protocol=http\nhost=git.garvis.dev\npath=dmg/purpur-ignis.git\n\n",
|
||||
"protocol=https\nhost=git.garvis.dev\npath=dmg/spigot-ignis.git\n\n",
|
||||
"protocol=https\nhost=git.garvis.dev\npath=dmg/other.git\n\n")) {
|
||||
var builder = new ProcessBuilder("sh", helper.toString(), "get");
|
||||
builder.environment().put("IGNIS_RELEASE_TOKEN", "synthetic-test-token");
|
||||
@@ -38,7 +39,7 @@ class ReleaseCredentialTest {
|
||||
builder.environment().put("GIT_TERMINAL_PROMPT", "0");
|
||||
Process process = builder.start();
|
||||
try (var input = process.getOutputStream()) {
|
||||
input.write("protocol=https\nhost=git.garvis.dev\npath=dmg/spigot-ignis.git\n\n".getBytes(StandardCharsets.UTF_8));
|
||||
input.write("protocol=https\nhost=git.garvis.dev\npath=dmg/purpur-ignis.git\n\n".getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
assertTrue(process.waitFor(3, TimeUnit.SECONDS));
|
||||
assertEquals(0, process.exitValue());
|
||||
|
||||
@@ -12,7 +12,9 @@ class ReleaseWorkflowTest {
|
||||
Path path = Path.of(".gitea/workflows/release.yml");
|
||||
assertTrue(Files.exists(path), "Release workflow must exist");
|
||||
String workflow = Files.readString(path);
|
||||
assertTrue(workflow.contains("spigot-ignis-${VERSION}.jar"));
|
||||
assertTrue(workflow.contains("purpur-ignis-${VERSION}.jar"));
|
||||
assertEquals(2, workflow.split("test \\\"\\$REPOSITORY\\\" = 'dmg/purpur-ignis'", -1).length - 1);
|
||||
assertFalse(workflow.contains("dmg/spigot-ignis"));
|
||||
assertTrue(workflow.contains("--header @-"));
|
||||
assertTrue(workflow.contains("git-credential-ignis.sh"));
|
||||
assertTrue(workflow.contains("credential.useHttpPath true"));
|
||||
|
||||
@@ -5,6 +5,42 @@ import java.util.UUID;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class VoidTrialTest {
|
||||
@Test
|
||||
void inspectionIsImmutableAndDoesNotChangeChallengeCompletion() {
|
||||
var trial = new VoidTrial();
|
||||
UUID player = UUID.randomUUID(), world = UUID.randomUUID();
|
||||
assertTrue(trial.snapshot(player).isEmpty());
|
||||
trial.damaged(player, world, -65);
|
||||
assertTrue(trial.snapshot(player).isPresent(), "Active attempt must be inspectable");
|
||||
var initial = trial.snapshot(player).orElseThrow();
|
||||
assertEquals(world, initial.world());
|
||||
assertEquals(-65, initial.damageHeight());
|
||||
assertFalse(initial.escaped());
|
||||
assertEquals(initial, trial.snapshot(player).orElseThrow());
|
||||
trial.moved(player, world, 20, false, false, false);
|
||||
assertFalse(trial.snapshot(player).orElseThrow().escaped());
|
||||
trial.moved(player, world, 20, true, false, false);
|
||||
assertTrue(trial.snapshot(player).orElseThrow().escaped());
|
||||
assertFalse(initial.escaped(), "A returned snapshot must not change after later events");
|
||||
assertTrue(trial.moved(player, world, 60, false, true, true));
|
||||
assertTrue(trial.snapshot(player).isEmpty());
|
||||
assertFalse(trial.moved(player, world, 60, false, true, true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void inspectionClearsAfterCancellationWorldChangeAndRestart() {
|
||||
var trial = new VoidTrial();
|
||||
UUID player = UUID.randomUUID(), world = UUID.randomUUID();
|
||||
trial.damaged(player, world, -65);
|
||||
trial.cancel(player);
|
||||
assertTrue(trial.snapshot(player).isEmpty());
|
||||
trial.damaged(player, world, -65);
|
||||
trial.moved(player, UUID.randomUUID(), 60, true, false, false);
|
||||
assertTrue(trial.snapshot(player).isEmpty());
|
||||
trial.damaged(player, world, -65);
|
||||
assertTrue(new VoidTrial().snapshot(player).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void requiresDamageAscentWhileGlidingAndFirstLandingOnEndStone() {
|
||||
var trial = new VoidTrial();
|
||||
|
||||
Reference in new issue
Block a user