Files
2026-05-26 23:14:19 -04:00

77 lines
3.5 KiB
Markdown

# Commands
Currently one in-game admin command: `/networkcore`.
All subcommands are run by an in-world player. Console support isn't wired up yet.
## Permissions
Every subcommand is gated by a permission node, checked via Hytale's `PermissionsModule`. Assign these to your staff/admin groups in the Hytale server's own permission config.
| Subcommand | Required permission |
|---|---|
| `/networkcore status` | `networkcore.status` |
| `/networkcore servers` | `networkcore.servers` |
| `/networkcore publish` | `networkcore.publish` |
| `/alert <message>` | `networkcore.alert` |
| `/glist` | `networkcore.glist` |
| `/hub` | `networkcore.hub` |
| `/send <player> <id\|role>` | `networkcore.send` |
The four "BungeeCord-style" commands at the bottom are documented in detail in [11_Network_Features.md](11_Network_Features.md).
You can grant the whole namespace with `networkcore.*` (Hytale's permission system handles wildcards). A player without the relevant node sees Hytale's standard `You do not have permission for this command.` message - the command system itself blocks execution before our code runs.
Permissions are wired via `AbstractCommand.requirePermission(node)` in each subcommand constructor, and `canGeneratePermission()` is overridden to false on every command (including the root) so Hytale doesn't auto-generate a different one and clash with ours.
## /networkcore status
Prints local server identity, Redis state, and the metrics endpoint.
Example output:
```
=== NetworkCore ===
Server id: lobby-3f2a91bd
Role: lobby
Players: 12
Known servers: 4
Metrics: http://127.0.0.1:9100/metrics
```
If you see `Network: not connected (Redis unavailable)`, NetworkCore failed to open the Redis connection at start. Check the server log for the underlying error and verify `redis.host` / `redis.port` / `REDIS_PASSWORD`.
## /networkcore servers
Lists every server NetworkCore currently knows about (including itself).
Example:
```
=== Network Servers ===
lobby-3f2a91bd | role=lobby | players=12
bridge_duel-9c1b22a4 | role=bridge_duel | players=8
bridge_duel-d8e09131 | role=bridge_duel | players=0
arena-1f4e0bcc | role=arena | players=3
```
This reads from the local cache - same source as `ServerRegistry.getServers()`. If a server is missing here, either it hasn't joined the network yet or it failed to heartbeat (see [06_ServerRegistry.md](06_ServerRegistry.md) for detection latency).
## /networkcore publish &lt;channel&gt; &lt;json&gt;
Publishes a raw JSON payload to a MessageBus channel. Dev/debug helper - useful for poking subscribers without writing test code.
```
/networkcore publish chat.global {"from":"console","text":"test"}
```
The JSON is parsed and wrapped in the standard envelope (with your auth token if configured) before being sent. If the JSON is malformed you'll get an error in chat.
This is dangerous in production - it lets anyone with command access spoof any message on any channel. Lock it down with permissions before exposing to non-admins.
## Things this command does *not* do (and why)
- **Restart Redis / reload config.** Restart the server. Reload is fragile - half-loaded state is worse than no state.
- **Kick a server out of the network.** Servers self-register and self-deregister. If you want a server gone, stop its process. If you need to "evict" it administratively, that's a separate ops tool.
- **Send a chat message to all servers.** This belongs in a chat plugin that uses MessageBus, not in the core admin command.