aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_swapid.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 20:11:29 -0400
committerhistoria <[not public]>2026-09-18 20:11:29 -0400
commit0f812ccc307ea0550511ccced40b65dfb0cdaa91 (patch)
tree7f2f343985275a478ba7295a37fcd48871ca4956 /internal/game/cmd_swapid.go
parent79764732406d6484f67d3dec045483dcb5d08c28 (diff)
downloadthehouseoficarus-0f812ccc307ea0550511ccced40b65dfb0cdaa91.tar.gz
fix: world and casino integrity fixes
Diffstat (limited to 'internal/game/cmd_swapid.go')
-rw-r--r--internal/game/cmd_swapid.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/internal/game/cmd_swapid.go b/internal/game/cmd_swapid.go
index 8b637fb..d1dbd68 100644
--- a/internal/game/cmd_swapid.go
+++ b/internal/game/cmd_swapid.go
@@ -66,13 +66,15 @@ func (g *Game) executeSwapID(sess *net.Session, args []string, rawInput string)
// Refuse while non-admin players are online: swapping room IDs relocates
// every character whose state embeds those IDs, which is disruptive to
// normal play. Admins may stay online (their own state is migrated too).
- for _, other := range g.Hub.AllSessions() {
- if other == sess || other.Player == nil {
- continue
- }
- if !g.checkAdmin(other) {
- sess.WriteLine("Cannot swap room IDs while non-admin players are online.")
- return
+ if g.Hub != nil {
+ for _, other := range g.Hub.AllSessions() {
+ if other == sess || other.Player == nil {
+ continue
+ }
+ if !g.checkAdmin(other) {
+ sess.WriteLine("Cannot swap room IDs while non-admin players are online.")
+ return
+ }
}
}