From 27aed4abc9e47f33df75679cc625620ad1a0b292 Mon Sep 17 00:00:00 2001 From: Michael Gilardi <11632652+mgilardi@users.noreply.github.com> Date: Tue, 1 Dec 2026 07:59:56 -0700 Subject: [PATCH 1/4] Shut the server down when Posse is disabled while it runs D401: a disabled plugin's listeners stop working, so home worlds, circles, chat limits and the join pause would all lift with players still online. Unless the server is already stopping, Posse now asks Paper to shut down, disconnects everyone with a plain message, and logs why. It disconnects everyone itself because Paper's stop disables every other plugin before it kicks anyone, and chat runs on its own thread, so players could otherwise still reach each other for that time. The test helper gets /mt disable, and a new bot suite, disable-guard.js, drives it while running and while paused. Tested: ./gradlew build, 275 unit tests, none skipped. disable-guard.js 21/21 on Paper 26.1.2. Not tested: disable-guard.js on 26.2 and 26.3; the full suite.js on any version (a 26.1.2 run was stopped partway for a test-server hold); /reload itself, a plugin error, a failed shutdown and a disable off the main thread. Task: K964 Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 ++ README.md | 2 +- build.gradle.kts | 2 +- .../com/extantape/posse/DisableGuard.java | 63 ++++++++++++++ .../java/com/extantape/posse/PossePlugin.java | 16 ++++ .../com/extantape/posse/DisableGuardTest.java | 77 +++++++++++++++++ test/live/README.md | 3 +- test/live/disable-guard.js | 85 +++++++++++++++++++ .../posse/livetest/LiveTestHelper.java | 10 +++ 9 files changed, 261 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/extantape/posse/DisableGuard.java create mode 100644 src/test/java/com/extantape/posse/DisableGuardTest.java create mode 100644 test/live/disable-guard.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 552c058..d424931 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.11.4 (not released) + +- **Disabling Posse while the server runs now shuts the server down** (D401). A disabled plugin's listeners stop working, so home worlds, circles, chat limits and the join pause would all lift with players still online. Now, unless the server is already stopping, Posse logs "Posse was disabled while the server was running, so its safety rules no longer apply. Shutting the server down. Start it again to bring the rules back." and asks Paper to shut down, which saves the worlds as a normal stop does. It also disconnects everyone at once with "The server is stopping for a moment. Please come back later.", while its own listeners are still in place, because Paper's stop disables every other plugin before it disconnects anyone and chat runs on its own thread. This includes `/reload`, which disables every plugin first. A normal stop is left alone, and if the server can't say whether it's stopping, it's treated as running. If the shutdown itself fails, the log says so and asks for a manual stop. It can't help if the jar is removed, the plugin never loads, the process is killed, or another plugin unregisters Posse's listeners without disabling it. +- Tested: `./gradlew build` passes, with 275 unit tests and none skipped. Seven are new, covering the order of shutdown, disconnect and log line, a stopping server, an unreadable stopping state, a failed shutdown, a failed disconnect, a failing logger and the wording. `disable-guard.js` is a new bot suite. It uses the test helper's new `/mt disable` to disable Posse on a running server, once with two players online and once while Posse is paused on a broken config. It checks the log line, that the server exits by itself, that each player is disconnected with Posse's own message, that a normal stop says nothing, and that the server starts again and lets players in. It passed 21 of 21 checks on Paper 26.1.2. +- **Not tested:** `disable-guard.js` on 26.2 and 26.3. The full `suite.js`, covering startup, pause and joins, on any version: a run on 26.1.2 was stopped partway for a hold on test servers. `/reload` itself (the same `onDisable` runs, but no bot drives it), an error that makes Paper disable the plugin, a failed shutdown, and disabling from a thread other than the main one, where Posse leaves disconnecting to the server's stop. No real game client has seen this version. + ## 0.11.3 - **Read this before upgrading with home worlds on: an adult circle with no entry becomes restricted until it gets `unlimited: true`.** Before, a player in any circle without an entry was never moved. diff --git a/README.md b/README.md index 9cd0c33..5243175 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Otherwise they can't. A world group is a world with its Nether and End (`surviva - If another plugin cancels that disconnect, Posse tries again twice a second until the player has gone. Until then they are held: hidden from everyone, with everyone hidden from them, and unable to move, teleport, chat, send messages or commands, write, use or change blocks, take or deal damage through the usual events, drop or pick up items, or use inventories. They reach nobody. - Only the moved player gets a short line, such as "Welcome! You're in the lobby." (set per entry with `message`). Nobody else is told. -It is off unless the `home-worlds` section is there with something in it, and it needs at least one circle. A section whose only entries can't be used stays on. A mistake in a circle's own entry makes that entry add nothing, with a warning. A circle name that isn't in `circles`, a section or `no-circle` entry that can't be read, and a bad `lobby-world` are config errors, so nothing half-applies. `no-circle` always needs `worlds`. `unlimited` there is ignored with a warning. Not covered: a pending player's screen still shows the world around them, with its signs, builds and animals. The hold works through the server's events, so anything another plugin does for a player without those events isn't stopped. A plugin that also gets in after Posse's last look at a teleport can let it through; the check after the world change then catches it, just after it happens. **If Posse is disabled or removed while the server runs, none of these rules apply.** Posse also can't see a world that another plugin loads after the player joins. A respawn can't be cancelled. If a player has to be disconnected while respawning, Posse points the respawn back at the world they died in when their group may be there. If neither world is allowed, the server may save them where it respawned them. They're held until they leave and checked again when they next join. If the config can't be read at startup, Posse can't tell who is in which circle, so it refuses joins (see below). +It is off unless the `home-worlds` section is there with something in it, and it needs at least one circle. A section whose only entries can't be used stays on. A mistake in a circle's own entry makes that entry add nothing, with a warning. A circle name that isn't in `circles`, a section or `no-circle` entry that can't be read, and a bad `lobby-world` are config errors, so nothing half-applies. `no-circle` always needs `worlds`. `unlimited` there is ignored with a warning. Not covered: a pending player's screen still shows the world around them, with its signs, builds and animals. The hold works through the server's events, so anything another plugin does for a player without those events isn't stopped. A plugin that also gets in after Posse's last look at a teleport can let it through; the check after the world change then catches it, just after it happens. **If Posse is disabled while the server runs, it shuts the server down**, unless the server is already stopping, so nobody plays without these rules. It disconnects everyone straight away with "The server is stopping for a moment. Please come back later." That includes `/reload`. If the jar is removed, the plugin never loads, the process is killed, or another plugin removes Posse's listeners without disabling it, none of these rules apply. Posse also can't see a world that another plugin loads after the player joins. A respawn can't be cancelled. If a player has to be disconnected while respawning, Posse points the respawn back at the world they died in when their group may be there. If neither world is allowed, the server may save them where it respawned them. They're held until they leave and checked again when they next join. If the config can't be read at startup, Posse can't tell who is in which circle, so it refuses joins (see below). **Book authors.** A written book shows its author only to the author, players who share a circle with them, and players with `posse.bypass`. Everyone else sees "Unknown" (`book-authors.shown-as`), and a title that holds the author's name shows `****` for it. That includes the BetonQuest quest journal, which carries its owner's name. Same world doesn't count, only circles, so a kid and an adult standing together still don't see each other's names. It is on by default; set `book-authors.hide: false` to turn it off. With no circles set up nothing is hidden. diff --git a/build.gradle.kts b/build.gradle.kts index 7a11fc3..337ec39 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } group = "com.extantape" -version = "0.11.3" +version = "0.11.4" java { toolchain.languageVersion.set(JavaLanguageVersion.of(25)) diff --git a/src/main/java/com/extantape/posse/DisableGuard.java b/src/main/java/com/extantape/posse/DisableGuard.java new file mode 100644 index 0000000..3e20a59 --- /dev/null +++ b/src/main/java/com/extantape/posse/DisableGuard.java @@ -0,0 +1,63 @@ +package com.extantape.posse; + +import java.util.function.BooleanSupplier; +import java.util.function.Consumer; + +/** + * What happens when Posse is disabled (D401). A disabled plugin's listeners stop working, so every rule Posse keeps + * (home worlds, circles, chat and the join pause) would lift while players stay on. Unless the server is already + * stopping, Posse shuts it down, so nobody plays without the rules. + * + *

Paper's shutdown only asks the main loop to stop. The stop then disables every other plugin before it disconnects + * anyone, and chat runs on its own thread, so players could still reach each other for that whole time. Posse therefore + * disconnects everyone itself, while its own listeners are still in place. + * + *

This can't help if the jar is removed, the plugin never loads, the process is killed, or another plugin + * unregisters Posse's listeners without disabling it. + */ +final class DisableGuard { + static final String STOPPING = + "Posse was disabled while the server was running, so its safety rules no longer apply. Shutting the server down. Start it again to bring the rules back."; + + static final String SHUTDOWN_FAILED = + "Posse was disabled while the server was running, so its safety rules no longer apply, and the server couldn't be shut down. Stop it now."; + + /** What each player sees when they are disconnected. Kept plain, since many players are children. */ + static final String DISCONNECTED = "The server is stopping for a moment. Please come back later."; + + private DisableGuard() { + } + + /** + * Unless the server is already stopping: asks it to shut down, disconnects everyone, then logs why. Each step runs + * even if the one before it failed, and nothing escapes. If the server can't say whether it is stopping, it is + * treated as running. Returns true if a shutdown was asked for. + */ + static boolean onDisable(BooleanSupplier serverStopping, Runnable shutDown, Runnable disconnectEveryone, + Consumer log) { + boolean stopping; + try { + stopping = serverStopping.getAsBoolean(); + } catch (Throwable t) { + stopping = false; + } + if (stopping) return false; + String message = STOPPING; + try { + shutDown.run(); + } catch (Throwable t) { + message = SHUTDOWN_FAILED; + } + try { + disconnectEveryone.run(); + } catch (Throwable ignored) { + // The server's own stop disconnects anyone left. + } + try { + log.accept(message); + } catch (Throwable ignored) { + // Nothing may escape onDisable before the rest of the clean-up runs. + } + return true; + } +} diff --git a/src/main/java/com/extantape/posse/PossePlugin.java b/src/main/java/com/extantape/posse/PossePlugin.java index 14ed86f..067b1ff 100644 --- a/src/main/java/com/extantape/posse/PossePlugin.java +++ b/src/main/java/com/extantape/posse/PossePlugin.java @@ -179,6 +179,9 @@ private void openJoinsIfSafe() { @Override public void onDisable() { + // D401: no playing without the rules. Paper's shutdown only asks the main loop to stop, so it is safe here. + DisableGuard.onDisable(() -> getServer().isStopping(), () -> getServer().shutdown(), this::disconnectEveryone, + getLogger()::severe); getServer().getServicesManager().unregisterAll(this); if (presence != null) presence.showAll(); else { @@ -190,6 +193,19 @@ public void onDisable() { com.extantape.posse.rules.Pending.clear(); } + // Kicks only work on the main thread. Off it, the server's own stop disconnects everyone a little later. + private void disconnectEveryone() { + if (!Bukkit.isPrimaryThread()) return; + net.kyori.adventure.text.Component reason = net.kyori.adventure.text.Component.text(DisableGuard.DISCONNECTED); + for (Player player : List.copyOf(Bukkit.getOnlinePlayers())) { + try { + player.kick(reason, org.bukkit.event.player.PlayerKickEvent.Cause.PLUGIN); + } catch (Throwable ignored) { + // One player's kick failing mustn't keep the others on. + } + } + } + public com.extantape.posse.listen.PresenceListener presence() { return presence; } diff --git a/src/test/java/com/extantape/posse/DisableGuardTest.java b/src/test/java/com/extantape/posse/DisableGuardTest.java new file mode 100644 index 0000000..5809f10 --- /dev/null +++ b/src/test/java/com/extantape/posse/DisableGuardTest.java @@ -0,0 +1,77 @@ +package com.extantape.posse; + +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** D401: nobody plays without Posse's rules. */ +class DisableGuardTest { + private final List steps = new ArrayList<>(); + + private boolean disable(boolean stopping) { + return DisableGuard.onDisable(() -> stopping, () -> steps.add("shutdown"), () -> steps.add("disconnect"), + line -> steps.add("log: " + line)); + } + + private static Runnable fails() { + return () -> { + throw new IllegalStateException("made up"); + }; + } + + @Test + void disabledWhileRunningShutsDownThenDisconnectsEveryoneThenSaysWhy() { + assertTrue(disable(false)); + assertEquals(List.of("shutdown", "disconnect", "log: " + DisableGuard.STOPPING), steps); + } + + @Test + void aServerAlreadyStoppingIsLeftAlone() { + assertFalse(disable(true)); + assertEquals(List.of(), steps); + } + + @Test + void ifTheServerCannotSayWhetherItIsStoppingItIsTreatedAsRunning() { + assertTrue(DisableGuard.onDisable(() -> { + throw new IllegalStateException("made up"); + }, () -> steps.add("shutdown"), () -> steps.add("disconnect"), line -> steps.add("log"))); + assertEquals(List.of("shutdown", "disconnect", "log"), steps); + } + + @Test + void aShutdownThatFailsStillDisconnectsEveryoneAndIsReported() { + assertTrue(DisableGuard.onDisable(() -> false, fails(), () -> steps.add("disconnect"), + line -> steps.add("log: " + line))); + assertEquals(List.of("disconnect", "log: " + DisableGuard.SHUTDOWN_FAILED), steps); + } + + @Test + void aDisconnectThatFailsCannotUndoTheShutdownOrTheLogLine() { + assertTrue(DisableGuard.onDisable(() -> false, () -> steps.add("shutdown"), fails(), + line -> steps.add("log: " + line))); + assertEquals(List.of("shutdown", "log: " + DisableGuard.STOPPING), steps); + } + + @Test + void aLoggerThatFailsCannotUndoTheShutdown() { + assertTrue(DisableGuard.onDisable(() -> false, () -> steps.add("shutdown"), () -> steps.add("disconnect"), + line -> { + throw new IllegalStateException("made up"); + })); + assertEquals(List.of("shutdown", "disconnect"), steps); + } + + @Test + void theMessagesSayWhatHappenedAndWhatToDo() { + assertTrue(DisableGuard.STOPPING.contains("safety rules no longer apply")); + assertTrue(DisableGuard.STOPPING.contains("Start it again")); + assertTrue(DisableGuard.SHUTDOWN_FAILED.contains("Stop it now")); + assertTrue(DisableGuard.DISCONNECTED.contains("come back later")); + } +} diff --git a/test/live/README.md b/test/live/README.md index f4b85a3..45f8e9c 100644 --- a/test/live/README.md +++ b/test/live/README.md @@ -55,8 +55,9 @@ It takes about 4 minutes. The summary lists failures and skipped checks. The ful | Graves (D231) | With a LanternGraves jar (`POSSE_LG_JAR`), real graves from planned deaths: each bot sees the owner's name or "Grave" exactly as an independent model of `mayKnow` says, with the owner in the same group, moved away, sharing a circle, offline, and in a circle-only world. Skipped without the jar. | | LuckPerms | A circle granted or removed takes effect with no relog. | | Config | A broken reload keeps the old rules; a broken config at startup refuses joins without `posse.bypass` and pauses chat and private messages, even for players with it, until it's fixed and reloaded. | +| Disabled while running (D401) | `disable-guard.js`, run with `POSSE_SUITE=disable-guard.js test/live/run.sh ` (about 1 minute). A normal `stop` logs nothing from Posse about being disabled. With two players online, `/mt disable Posse` makes Posse log why and shut the server down, the process exits by itself, and both players are disconnected with Posse's own message. The same happens while Posse is paused on a broken config. Then the server starts again and lets players in. `/reload` and a plugin error aren't driven. | | Load | 20 more bots, 300 lines in about 15 seconds: all delivered within their circle, TPS, chat latency, no kicks. | ## The test-only plugins -`helper/` makes worlds, moves players, gives items and reports TPS, with one console command, `/mt`, and has one player command, `/mtwho`, whose Tab offers every online player, as a plugin that knows nothing of Posse would. `/mt blockkick` cancels a player's kicks while it's on, and `/mt allowlogin` allows one refused login again, standing in for another plugin doing either. It also stops test players taking damage, since a bot that spawns inside a block in a made-up Nether would otherwise die and respawn in the wrong world. `fakeminimap/` is the BlueMapMini stand-in. Both are built by `./gradlew build` and never shipped. Never install either on a real server. +`helper/` makes worlds, moves players, gives items and reports TPS, with one console command, `/mt`, and has one player command, `/mtwho`, whose Tab offers every online player, as a plugin that knows nothing of Posse would. `/mt blockkick` cancels a player's kicks while it's on, and `/mt allowlogin` allows one refused login again, standing in for another plugin doing either. `/mt disable ` disables a plugin on a running server, as an admin tool or a plugin error would. It also stops test players taking damage, since a bot that spawns inside a block in a made-up Nether would otherwise die and respawn in the wrong world. `fakeminimap/` is the BlueMapMini stand-in. Both are built by `./gradlew build` and never shipped. Never install either on a real server. diff --git a/test/live/disable-guard.js b/test/live/disable-guard.js new file mode 100644 index 0000000..60f6c64 --- /dev/null +++ b/test/live/disable-guard.js @@ -0,0 +1,85 @@ +// D401: if Posse is disabled while the server is running, the server shuts down. See README.md in this folder. +// Usage: node disable-guard.js

, relative to the work folder. +const fs = require('fs'); +const { sleep, check, section, summary, Server, Bot } = require('./lib.js'); +const [dir, jar, port] = process.argv.slice(2); + +const LINE = /\[Posse\] Posse was disabled while the server was running, so its safety rules no longer apply\. Shutting the server down\./; +const KICK = /The server is stopping for a moment\. Please come back later\./; +const CONFIG = 'circles: [kids, adults]\ncircle-only-worlds: [world]\n'; +const BROKEN = 'circles: [red\nnope: : :'; + +let s; +const exitsWithin = (ms) => Promise.race([s.exited, sleep(ms).then(() => 'timeout')]); +// The server stopped by itself, so keep its console output the way Server.stop() would. +function keepLog() { fs.appendFileSync(s.dir + '-console.log', s.log); s.proc = null; } + +async function disableAndCheck(bots) { + const m = s.mark(); + const t = Date.now(); + s.cmd('mt disable Posse'); + const code = await exitsWithin(60000); + const after = s.since(m); + check('the helper disabled Posse', /HRT disable Posse start/.test(after)); + check('Posse logs why it is shutting the server down', LINE.test(after)); + check('the server process exits by itself', code !== 'timeout', `exit ${code} after ${Date.now() - t} ms`); + check('the server went through its normal stop', /Stopping server|Stopping the server/.test(after)); + for (const b of bots) { + // Posse's own message proves Posse disconnected them, before the server's stop would have. + check(`${b.name} is disconnected by Posse with a plain message`, b.kicked !== null && KICK.test(b.kicked), b.kicked || b.ended || 'still connected'); + } + const lineAt = after.search(LINE), stopAt = after.search(/Stopping server|Stopping the server/); + check('the shutdown starts after Posse is disabled', lineAt >= 0 && (stopAt < 0 || lineAt < stopAt), `line ${lineAt} stop ${stopAt}`); + const severe = after.split('\n').filter((l) => /ERROR\]: \[Posse\]|at com\.extantape\.posse/.test(l) && !LINE.test(l)); + check('no other Posse errors', severe.length === 0, severe.slice(0, 3).join(' || ')); + bots.forEach((b) => b.quit()); + keepLog(); +} + +(async () => { + s = new Server(dir, jar); + await s.start(); + s.writeConfig('config.yml', CONFIG); + check('the test config loads', await s.run('posse reload', /\[Posse\] Reloaded/, 10000) !== null); + + section('A normal stop is left alone'); + let m = s.mark(); + const t0 = Date.now(); + s.cmd('stop'); + const stopped = await exitsWithin(60000); + check('the server stops normally', stopped !== 'timeout', `exit ${stopped} after ${Date.now() - t0} ms`); + check('Posse says nothing about being disabled while running', !LINE.test(s.since(m))); + keepLog(); + + section('Posse disabled while running shuts the server down and disconnects everyone'); + await s.start(); + const kid = new Bot('Kd1', +port); await kid.spawned; + const adult = new Bot('Ad1', +port); await adult.spawned; + await sleep(1500); + await disableAndCheck([kid, adult]); + + section('Posse disabled while paused on a broken config shuts the server down too'); + s.writeConfig('config.yml', BROKEN); + await s.start(); + check('Posse started paused', /\[Posse\] Posse couldn't read its config/.test(s.log)); + await disableAndCheck([]); + + section('It starts again normally'); + s.writeConfig('config.yml', CONFIG); + await s.start(); + check('Posse is enabled after the restart', /\[Posse\] (Circles|Enabling Posse)/.test(s.log)); + const kid2 = new Bot('Kd1', +port); + let joined = true; + try { await kid2.spawned; } catch { joined = false; } + check('a player can join after the restart', joined, kid2.kicked || ''); + kid2.quit(); await sleep(500); + m = s.mark(); + await s.stop(); + check('the final normal stop is left alone too', !LINE.test(s.since(m))); + process.exit(summary() ? 1 : 0); +})().catch(async (e) => { + console.log('CRASHED', e && e.stack || e); + try { if (s && s.proc) await s.stop(); } catch { } + summary(); + process.exit(1); +}); diff --git a/test/live/helper/src/main/java/com/extantape/posse/livetest/LiveTestHelper.java b/test/live/helper/src/main/java/com/extantape/posse/livetest/LiveTestHelper.java index 32ce755..5f61504 100644 --- a/test/live/helper/src/main/java/com/extantape/posse/livetest/LiveTestHelper.java +++ b/test/live/helper/src/main/java/com/extantape/posse/livetest/LiveTestHelper.java @@ -39,6 +39,8 @@ * mt where prints "HRT where " * mt tps prints "HRT tps <1m> mspt " * mt worlds prints "HRT worlds " + * mt disable disables that plugin while the server runs, as an admin tool or a plugin error might; + * prints "HRT disable start", then "HRT disable " * mt unload unloads an empty world, as a failed or removed world would be; prints "HRT unload " * mt give puts one item in the player's main hand * mt book puts a signed book in the player's first slot (D291) @@ -315,6 +317,14 @@ public void onEnable() { getLogger().info("HRT unload " + name + " " + (world != null && Bukkit.unloadWorld(world, true))); return 1; }))) + .then(Commands.literal("disable").then(Commands.argument("plugin", StringArgumentType.word()).executes(ctx -> { + String name = StringArgumentType.getString(ctx, "plugin"); + org.bukkit.plugin.Plugin target = Bukkit.getPluginManager().getPlugin(name); + getLogger().info("HRT disable " + name + " start"); + if (target != null) Bukkit.getPluginManager().disablePlugin(target); + getLogger().info("HRT disable " + name + " " + (target != null && !target.isEnabled())); + return 1; + }))) .then(Commands.literal("worlds").executes(ctx -> { getLogger().info("HRT worlds " + String.join(",", Bukkit.getWorlds().stream().map(World::getName).toList())); return 1; From 992c4fc9a86e9df9d15d8f701df923c13c3d4a15 Mon Sep 17 00:00:00 2001 From: Michael Gilardi <11632652+mgilardi@users.noreply.github.com> Date: Tue, 1 Dec 2026 10:12:00 -0700 Subject: [PATCH 2/4] Record the full bot suite passing on 26.1.2 suite.js passed 87 of 87 on Paper 26.1.2 with the disable change (3 skipped: sign text and anvil renames need a real client, graves need a LanternGraves jar). disable-guard.js and suite.js on 26.2 and 26.3 are still not run. Task: K964 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d424931..2abfc07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,8 @@ ## 0.11.4 (not released) - **Disabling Posse while the server runs now shuts the server down** (D401). A disabled plugin's listeners stop working, so home worlds, circles, chat limits and the join pause would all lift with players still online. Now, unless the server is already stopping, Posse logs "Posse was disabled while the server was running, so its safety rules no longer apply. Shutting the server down. Start it again to bring the rules back." and asks Paper to shut down, which saves the worlds as a normal stop does. It also disconnects everyone at once with "The server is stopping for a moment. Please come back later.", while its own listeners are still in place, because Paper's stop disables every other plugin before it disconnects anyone and chat runs on its own thread. This includes `/reload`, which disables every plugin first. A normal stop is left alone, and if the server can't say whether it's stopping, it's treated as running. If the shutdown itself fails, the log says so and asks for a manual stop. It can't help if the jar is removed, the plugin never loads, the process is killed, or another plugin unregisters Posse's listeners without disabling it. -- Tested: `./gradlew build` passes, with 275 unit tests and none skipped. Seven are new, covering the order of shutdown, disconnect and log line, a stopping server, an unreadable stopping state, a failed shutdown, a failed disconnect, a failing logger and the wording. `disable-guard.js` is a new bot suite. It uses the test helper's new `/mt disable` to disable Posse on a running server, once with two players online and once while Posse is paused on a broken config. It checks the log line, that the server exits by itself, that each player is disconnected with Posse's own message, that a normal stop says nothing, and that the server starts again and lets players in. It passed 21 of 21 checks on Paper 26.1.2. -- **Not tested:** `disable-guard.js` on 26.2 and 26.3. The full `suite.js`, covering startup, pause and joins, on any version: a run on 26.1.2 was stopped partway for a hold on test servers. `/reload` itself (the same `onDisable` runs, but no bot drives it), an error that makes Paper disable the plugin, a failed shutdown, and disabling from a thread other than the main one, where Posse leaves disconnecting to the server's stop. No real game client has seen this version. +- Tested: `./gradlew build` passes, with 275 unit tests and none skipped. Seven are new, covering the order of shutdown, disconnect and log line, a stopping server, an unreadable stopping state, a failed shutdown, a failed disconnect, a failing logger and the wording. `disable-guard.js` is a new bot suite. It uses the test helper's new `/mt disable` to disable Posse on a running server, once with two players online and once while Posse is paused on a broken config. It checks the log line, that the server exits by itself, that each player is disconnected with Posse's own message, that a normal stop says nothing, and that the server starts again and lets players in. It passed 21 of 21 checks on Paper 26.1.2. The full `suite.js`, which covers startup, pause and joins, passed 87 of 87 on 26.1.2, with 3 skipped: sign text and anvil renames need a real client, and graves need a LanternGraves jar. +- **Not tested:** `disable-guard.js` and `suite.js` on 26.2 and 26.3. `/reload` itself (the same `onDisable` runs, but no bot drives it), an error that makes Paper disable the plugin, a failed shutdown, and disabling from a thread other than the main one, where Posse leaves disconnecting to the server's stop. No real game client has seen this version. ## 0.11.3 From 7ac04e0d175bb414ed3c38b540c1725df903a978 Mon Sep 17 00:00:00 2001 From: Michael Gilardi <11632652+mgilardi@users.noreply.github.com> Date: Tue, 1 Dec 2026 20:08:10 -0700 Subject: [PATCH 3/4] Record the 26.2 and 26.3 bot runs for 0.11.4 disable-guard.js passed 21 of 21 and suite.js 87 of 87 (3 skipped) on Paper 26.1.2 build 74, 26.2 build 135 and 26.3 build 273, each on a throwaway local server deleted after the run. The changelog heading drops "not released" so the release only needs the merge and the tag. Still not tested: /reload itself, a plugin error that disables Posse, a failed shutdown, an off-thread disable, and a real game client. Task: K964 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2abfc07..1f31f3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ # Changelog -## 0.11.4 (not released) +## 0.11.4 - **Disabling Posse while the server runs now shuts the server down** (D401). A disabled plugin's listeners stop working, so home worlds, circles, chat limits and the join pause would all lift with players still online. Now, unless the server is already stopping, Posse logs "Posse was disabled while the server was running, so its safety rules no longer apply. Shutting the server down. Start it again to bring the rules back." and asks Paper to shut down, which saves the worlds as a normal stop does. It also disconnects everyone at once with "The server is stopping for a moment. Please come back later.", while its own listeners are still in place, because Paper's stop disables every other plugin before it disconnects anyone and chat runs on its own thread. This includes `/reload`, which disables every plugin first. A normal stop is left alone, and if the server can't say whether it's stopping, it's treated as running. If the shutdown itself fails, the log says so and asks for a manual stop. It can't help if the jar is removed, the plugin never loads, the process is killed, or another plugin unregisters Posse's listeners without disabling it. -- Tested: `./gradlew build` passes, with 275 unit tests and none skipped. Seven are new, covering the order of shutdown, disconnect and log line, a stopping server, an unreadable stopping state, a failed shutdown, a failed disconnect, a failing logger and the wording. `disable-guard.js` is a new bot suite. It uses the test helper's new `/mt disable` to disable Posse on a running server, once with two players online and once while Posse is paused on a broken config. It checks the log line, that the server exits by itself, that each player is disconnected with Posse's own message, that a normal stop says nothing, and that the server starts again and lets players in. It passed 21 of 21 checks on Paper 26.1.2. The full `suite.js`, which covers startup, pause and joins, passed 87 of 87 on 26.1.2, with 3 skipped: sign text and anvil renames need a real client, and graves need a LanternGraves jar. -- **Not tested:** `disable-guard.js` and `suite.js` on 26.2 and 26.3. `/reload` itself (the same `onDisable` runs, but no bot drives it), an error that makes Paper disable the plugin, a failed shutdown, and disabling from a thread other than the main one, where Posse leaves disconnecting to the server's stop. No real game client has seen this version. +- Tested: `./gradlew build` passes, with 275 unit tests and none skipped. Seven are new, covering the order of shutdown, disconnect and log line, a stopping server, an unreadable stopping state, a failed shutdown, a failed disconnect, a failing logger and the wording. `disable-guard.js` is a new bot suite. It uses the test helper's new `/mt disable` to disable Posse on a running server, once with two players online and once while Posse is paused on a broken config. It checks the log line, that the server exits by itself, that each player is disconnected with Posse's own message, that a normal stop says nothing, and that the server starts again and lets players in. It passed 21 of 21 checks on Paper 26.1.2 (build 74), 26.2 (build 135) and 26.3 (build 273). The full `suite.js`, which covers startup, pause and joins, passed 87 of 87 on each of those three, with 3 skipped: sign text and anvil renames need a real client, and graves need a LanternGraves jar. On 26.3 build 273, `suite.js`'s leave line check passes again (it failed on build 272); `presence-messages.js` wasn't rerun. +- **Not tested:** `/reload` itself (the same `onDisable` runs, but no bot drives it), an error that makes Paper disable the plugin, a failed shutdown, and disabling from a thread other than the main one, where Posse leaves disconnecting to the server's stop. No real game client has seen this version. ## 0.11.3 From 9f003c4096a2c2a5e47b2d0feaab89ed6660f4ed Mon Sep 17 00:00:00 2001 From: Michael Gilardi <11632652+mgilardi@users.noreply.github.com> Date: Tue, 1 Dec 2026 20:24:18 -0700 Subject: [PATCH 4/4] Run CI now that the pull request is ready for review The checks were skipped while it was a draft, and marking it ready does not start them. Task: K964 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>