Restarts and the game server gate
Drain a server or proxy before a restart, and keep players who are not in a match out of the game servers.
Two features keep restarts and game servers tidy:
- Drain stops new players and matches from going to a server or proxy, so it can be restarted when it is empty.
- The gate lets only players of a match onto a game server.
Both need the Velocity plugin from the same version as the backends. Drain also works on a single server without cross-server.
Drain a backend
Run on the server you want to restart:
/md drain start
/md drain start Updating to 0.10.1
/md drain status
/md drain stop/md drain needs mineduels.admin. The reason is optional and only shown in status and the webhook.
To drain from a script, or to drain another server of the network from one place, use the web API.
Example status output while two matches are still running:
[MineDuels] Draining for 3 min (Updating to 0.10.1): 4 players, 2 running matches, 0 pending assignments.When nothing is left it adds Empty.
What a draining server refuses
| Action | Result |
|---|---|
/queue, queue menu, queue signs | The player is told the server is about to restart (queue.draining in messages.yml). |
/duel and accepting a duel | Same message. |
| Starting a party game, party duel or Red Rover | Same message. |
| Hosting a tournament | Same message. |
| A match assigned by the matchmaker | The server cancels it and the players queue again with their waiting time kept. |
/spectate from another server | The server answers that the player is not in a match. |
/servers | The entry shows Restarting and cannot be chosen (cross-server.server-draining). |
The other servers see the flag in the heartbeat within 2 seconds. They stop choosing the server:
| Server role | Effect |
|---|---|
| Lobby | Not chosen as the least full lobby, not chosen as a return lobby, not shown as joinable. The proxy sends new players to another lobby. |
| Game | Reports no free arenas, so the matchmaker never picks it. |
What a draining server still allows
| Action | Why |
|---|---|
| Running matches finish | Nobody loses a match. |
| A player who disconnected from a running match can rejoin it | The match is still running, so the rejoin ticket still works. |
Staff with mineduels.proxy.bypass | The proxy lets them connect to a draining lobby. |
Drain is not saved. A restart clears it, which is the point.
Examples
Restart a game server without cutting matches:
/md drain start restart for updateWait for the drain-empty message in your webhook, then restart the server from the panel.
Cancel a drain you started by mistake:
/md drain stopDrain every lobby at once before a network update: run /md drain start on each lobby. Players are then sent to the lobbies that are still up. When no lobby is up, players who join are sent to the least full lobby the proxy can find, or refused (see drain.no-alternative below).
Drain a proxy
Run in the proxy console or in game with mineduels.proxy.admin:
/mdproxy drain start
/mdproxy drain start moving the proxy to a new host
/mdproxy drain status
/mdproxy drain stopWhile a proxy drains:
| Thing | Behaviour |
|---|---|
| New logins | Refused with "This proxy is restarting. Try again in a few minutes." Players with the bypass permission can still join. |
| Players on the proxy | They stay. Nobody is kicked. |
| Players from another proxy | The other proxies do not send players here. |
/mdproxy | The proxy and any draining backend are marked [draining]. |
With several proxies in different regions, new players join through the proxies that are not draining.
Example for a two proxy network:
# on proxy eu
/mdproxy drain start eu proxy update
# players join through proxy sg while eu empties
# restart eu when the webhook says proxy-emptyThe game server gate
A game server is for matches. The proxy lets a player connect to one only when:
- The player is in a match that was just assigned to that server (queue match, duel, party game or tournament), or
- The player was asked to go there to spectate, or
- The player holds a rejoin ticket after a disconnect during a match, or
- The player has the bypass permission.
Everyone else is told "Game servers are only for players in a match." A player who just joined the network is sent to a lobby instead of being disconnected.
Examples of what the gate does
| Situation | Result |
|---|---|
A player types /server game-1 | Refused. |
A player connects with a forced host that points to game-1 | Sent to a lobby. |
| A player is paired in the queue | Allowed for gate.admit-seconds (default 90), until they connect. |
A player loses connection in round 2 and logs in again within disconnect-grace-seconds | Allowed back into the running match. |
A staff member with mineduels.proxy.bypass joins game-1 to check an arena | Allowed. |
A player is told to spectate a player on game-1 | Allowed. |
Bypass permission
Give staff the bypass with your permissions plugin:
/lp group staff permission set mineduels.proxy.bypass trueThe proxy checks the permission when the player connects. The node can be renamed with gate.bypass-permission.
Velocity has no permission system of its own. Without a permissions plugin every player counts as having every permission. The proxy detects this, logs one error and trusts only gate.bypass-players:
gate.bypass-players=Notch,069a79f4-44e9-4726-a5be-fca90e38aaf5The same list decides who may use /mdproxy drain and /mdproxy reload while no permissions plugin is installed.
Settings in config.properties
An older file gets this block at the end on the first start, and a copy is saved as config.properties.bak-before-gate. Your lines are not changed.
config-version=2
gate.enabled=true
gate.admit-seconds=90
gate.bypass-permission=mineduels.proxy.bypass
gate.bypass-players=
gate.extra-servers=
gate.on-redis-down=allow
drain.no-alternative=deny| Key | Default | Meaning |
|---|---|---|
gate.enabled | true | false turns the gate off. Drain still works. |
gate.admit-seconds | 90 | How long a player stays admitted after the match was assigned. Range 10 to 600. |
gate.bypass-permission | mineduels.proxy.bypass | The node that skips the gate. |
gate.bypass-players | empty | Names or UUIDs, comma separated. The only bypass without a permissions plugin. |
gate.extra-servers | empty | velocity.toml server names to gate even though they send no heartbeat. |
gate.on-redis-down | allow | allow opens the gate while this proxy hears nothing from Redis, so a Redis outage does not break matches. deny keeps it closed. |
drain.no-alternative | deny | A draining lobby with no other lobby to go to. deny shows a restart message, allow lets the player in. |
Apply the gate settings without a restart:
/mdproxy reloadIt reloads the gate keys, balance-first-join and webhook.yml. Redis, secret and region settings need a restart.
Examples
Gate two extra servers that never send heartbeats:
gate.extra-servers=practice,event-hubLet a network stay open for staff only during testing:
gate.bypass-players=Alice,Bob
gate.on-redis-down=denyTurn the gate off while you debug a transfer problem:
gate.enabled=falseA restart, step by step
Game server game-2:
- Run
/md drain start updateongame-2. - The matchmaker stops choosing it within 2 seconds. Running matches finish.
- The webhook posts
drain-emptyafter the server stayed empty forstable-seconds. - Restart
game-2from the panel.
Proxy:
- Run
/mdproxy drain start. - New players use another proxy, or wait.
- The webhook posts
proxy-emptywhen nobody is connected. - Restart the proxy.
Things to know
- The gate knows who may enter from the matches the lobbies assign. A player assigned a match is admitted by memory only, so the check never waits on Redis.
- If the assignment message is lost, the player is sent to a lobby and the match is cancelled and requeued.
- The proxy and the backends must run the same version. An older backend ignores the drain flag.