Periodically sync remote gates instead of only loading once at startup

Gates were only ever loaded from the shared database at plugin enable
or /sg reload, so a server that's already running never found out
about a gate another backend created afterward - the row existed in
MySQL, but nothing told this JVM to look again. Reported as "no other
gates on network 'main'" despite both gates being visibly present in
the database.

Added GateManager.refreshRemoteGates(), scheduled every
cross-server.refresh-seconds (default 30) whenever cross-server is
enabled: it re-queries storage off the main thread, then merges only
OTHER servers' gates into gatesById on the main thread - adding new
ones, removing deleted ones, and never touching this server's own
gates or any live open/connected/outgoing runtime state.
This commit is contained in:
Michael Burgess
2026-08-09 13:11:38 -04:00
parent 2d47962ea1
commit 1b03009fa3
4 changed files with 60 additions and 0 deletions
+7
View File
@@ -119,6 +119,13 @@ proxy (over the `stargate:teleport` plugin channel) to connect the player to tha
server; once they land, the proxy forwards a delivery message so the destination
server's Stargate instance teleports them to the gate's exit point.
Each backend only loads gates from the shared database at startup (and on
`/sg reload`), then polls for what other servers have added, changed, or removed
every `cross-server.refresh-seconds` (default 30) while `cross-server.enabled: true`.
So a gate built on one server shows up as a destination on another within that
window automatically - no restart or manual reload needed, though `/sg reload`
still works if you want it immediately.
## Permissions
- `stargate.use` (default: true) — dial/cycle gates