
A Velocity proxy plugin that automatically stops and starts Minecraft server containers based on player activity
AutoStopper is a Velocity proxy plugin that automatically stops and starts Minecraft server containers based on player activity. It helps server administrators save resources by shutting down inactive Docker-based Minecraft servers.
plugins directoryAfter the first run, AutoStopper will generate a config.yml in the plugins/AutoStopper directory:
# Time in seconds before an inactive server is stopped
inactivity_timeout_seconds: 900
# List of servers AutoStopper should manage
monitored_servers:
- server_name: purpur
container_name: purpur-server
- server_name: fabric
container_name: fabric-server
inactivity_timeout_seconds: Time in seconds a server must be inactive before being shut down (default: 900 seconds/15 minutes)monitored_servers: List of server mappingsserver_name: Name of the server in Velocity configurationcontainer_name: Corresponding Docker container nameAutoStopper requires the Docker socket to be mounted in your Velocity container. Here's an example docker-compose.yml setup:
services:
velocity:
image: itzg/mc-proxy
container_name: velocity-server
environment:
TYPE: "VELOCITY"
ONLINE_MODE: "true"
VELOCITY_VERSION: "latest"
VELOCITY_BUILD_ID: "latest"
REPLACE_ENV_VARIABLES: "true"
ports:
- "25565:25565"
volumes:
- ./velocity_server:/server
- /var/run/docker.sock:/var/run/docker.sock # Required for AutoStopper
networks:
- mc-network
restart: unless-stopped
entrypoint: bash -c
command: >
"if [ ! -f /usr/bin/docker ]; then
apt-get update && apt-get install -y docker.io && apt-get clean;
fi &&
SOCKET_GID=$$(stat -c '%g' /var/run/docker.sock) &&
if ! getent group $$SOCKET_GID > /dev/null; then groupadd -g $$SOCKET_GID docker_sock; fi &&
GROUP_NAME=$$(getent group $$SOCKET_GID | cut -d: -f1) &&
usermod -aG $$GROUP_NAME bungeecord &&
exec /usr/bin/run-bungeecord.sh"
# Example Minecraft servers that can be managed by AutoStopper
purpur:
image: itzg/minecraft-server:java21
container_name: purpur-server
environment:
TYPE: "PURPUR"
VERSION: "1.21.4"
EULA: "TRUE"
ONLINE_MODE: "FALSE"
volumes:
- ./purpur_data:/data
networks:
- mc-network
restart: "no" # Important: Let AutoStopper manage the container lifecycle
fabric:
image: itzg/minecraft-server:java21
container_name: fabric-server
environment:
TYPE: "FABRIC"
VERSION: "1.21.4"
EULA: "TRUE"
ONLINE_MODE: "FALSE"
volumes:
- ./fabric_data:/data
networks:
- mc-network
restart: "no" # Important: Let AutoStopper manage the container lifecycle
networks:
mc-network:
driver: bridge
/var/run/docker.sock:/var/run/docker.sock)restart: "no" for managed servers so Docker doesn't automatically restart themrestart: unless-stopped if you want them to always be available/autostopper or /as - Main command/autostopper help - Displays help information/autostopper status - Shows the status of all monitored servers/autostopper reload - Reloads the configuration (requires autostopper.admin permission)autostopper.admin - Allows use of the reload commandWhen a player attempts to connect to a monitored server:
The plugin tracks the last activity time for each server
A scheduled task checks for inactive servers and stops them after the configured timeout period
Servers that are always needed (like hubs/lobbies) can be excluded from monitoring
Clone the repository
Build using Maven:
mvn clean package
Find the JAR file in target/AutoStopper-1.1.2.jar
This project is licensed under the MIT License. See the LICENSE file for details.