feat(particles): add account-wide visibility control
Release / release (push) Successful in 11m33s

This commit is contained in:
dmg committed 2026-09-23 07:11:10 -04:00
1 parent e3f2f2481b
commit 1ea4e8c13f
33 files changed
+472 -103

No files matched your search

@@ -36,7 +36,7 @@ class DistributionTest {
assertNull(metadata.getCommands().get("fantasyfeedback").get("permission"));
assertNull(metadata.getCommands().get("fantasyparticles").get("permission"));
assertEquals("/fantasyfeedback [on|off]", metadata.getCommands().get("fantasyfeedback").get("usage"));
assertEquals("/fantasyparticles players [on|off]",
assertEquals("/fantasyparticles <all|players> [on|off]",
metadata.getCommands().get("fantasyparticles").get("usage"));
assertTrue(metadata.getCommands().get("fantasystick").get("usage").toString().contains("adventure-site"));
assertTrue(metadata.getCommands().get("fantasystick").get("usage").toString().contains("quest-giver"));
@@ -45,6 +45,15 @@ class DistributionTest {
assertEquals(1, metadata.getPermissions().size());
assertEquals("fantasystick.admin", metadata.getPermissions().getFirst().getName());
assertEquals(org.bukkit.permissions.PermissionDefault.OP, metadata.getPermissions().getFirst().getDefault());
var directParticleEmitters = jar.stream().filter(entry -> entry.getName().endsWith(".class"))
.filter(entry -> {
try (var input = jar.getInputStream(entry)) {
return new String(input.readAllBytes(), java.nio.charset.StandardCharsets.ISO_8859_1)
.contains("spawnParticle");
} catch (java.io.IOException failure) { throw new java.io.UncheckedIOException(failure); }
}).map(java.util.zip.ZipEntry::getName).collect(java.util.stream.Collectors.toSet());
assertEquals(java.util.Set.of("games/dmg/fantasystick/presentation/ParticleDelivery.class"),
directParticleEmitters, "Every owned particle producer must route through viewer-aware delivery");
var configuration = jar.getJarEntry("config.yml");
assertNotNull(configuration, "Ship reviewed session defaults for administrators");
String defaults;
@@ -88,12 +88,16 @@ class PlayerFeedbackPreferencesTest {
assertFalse(preferences.playerAurasEnabled(account));
var accepted = preferences.setPlayerAuras(account, true).toCompletableFuture();
var acceptedAll = preferences.setAllParticles(account, false).toCompletableFuture();
preferences.close();
preferences.drained().toCompletableFuture().get(5, TimeUnit.SECONDS);
assertNotNull(accepted.get(5, TimeUnit.SECONDS));
assertNotNull(acceptedAll.get(5, TimeUnit.SECONDS));
assertFalse(preferences.playerAurasEnabled(account), "A closed lifetime does not publish its callback");
assertTrue(preferences.allParticlesEnabled(account), "A closed lifetime retains its effective all-particle state");
try (var reopened = new PlayerFeedbackPreferences(data)) {
assertTrue(reopened.playerAurasEnabled(account), "Accepted shutdown work is durable on restart");
assertFalse(reopened.allParticlesEnabled(account), "Accepted all-particle work is durable on restart");
}
}
@@ -103,12 +107,16 @@ class PlayerFeedbackPreferencesTest {
java.nio.file.Files.createDirectory(data.resolve("player-preferences.yml"));
assertThrows(Exception.class, () -> preferences.set(account, false).toCompletableFuture().get(5, TimeUnit.SECONDS));
assertThrows(Exception.class, () -> preferences.setPlayerAuras(account, true).toCompletableFuture().get(5, TimeUnit.SECONDS));
assertThrows(Exception.class, () -> preferences.setAllParticles(account, false).toCompletableFuture().get(5, TimeUnit.SECONDS));
assertTrue(preferences.enabled(account));
assertFalse(preferences.playerAurasEnabled(account));
assertTrue(preferences.allParticlesEnabled(account));
preferences.close();
assertThrows(Exception.class, () -> preferences.set(account, false).toCompletableFuture().get(5, TimeUnit.SECONDS));
assertThrows(Exception.class, () -> preferences.setPlayerAuras(account, true).toCompletableFuture().get(5, TimeUnit.SECONDS));
assertThrows(Exception.class, () -> preferences.setAllParticles(account, false).toCompletableFuture().get(5, TimeUnit.SECONDS));
assertTrue(preferences.enabled(account));
assertFalse(preferences.playerAurasEnabled(account));
assertTrue(preferences.allParticlesEnabled(account));
}
}