BuildContest Plugin
BuildContest is a Velocity plugin that simplifies the setup of dedicated servers for each team in a building contest. The plugin uses Docker Compose to start sub-servers and automatically transfers players to their respective sub-servers for the contest. Team configurations and server information are persistently stored.
Features
- Automatic Sub-Server Creation: Create team servers using HTTP API calls with Docker Compose, and register them with Velocity.
- Automatic Player Transfer: Players are automatically transferred to their corresponding sub-servers when joining the main server.
- Permission Control: Authenticate HTTP requests using Bearer Token.
- Prevent Duplicate Participation: When adding a team, if a player already exists in another team, they cannot join other teams.
Installation Steps
-
Prepare the Environment
- Install Velocity proxy server.
- Ensure Docker and Docker Compose are installed and properly configured.
-
Create a Minecraft Contest Server Image (Sub-Server)
- It's recommended to use Little Wrench as the server base.
- Set the port to
25565
and ensure it can be accessed correctly via the proxy, including properforwarding-mode
settings. - Create a Dockerfile for building the server image.
- Build the image, e.g.,
docker build -t minecraft-contest:latest .
- Create a
docker-compose.yml
file for starting the sub-server.
-
Download the Plugin
- Jump to version page
-
Configure the Plugin
- Place the plugin jar file in the
plugins/
directory of Velocity. - Start the Velocity server once to generate the configuration files, then stop the server to adjust settings.
- Place the plugin jar file in the
-
Configure Files
- Modify
config.yml
in theplugins/BuilderContest/
directory to set up ports and other settings. - Place
docker-compose-default.yml
in the plugin directory as the template for starting sub-servers.
- Modify
-
Start the Server
- Start the server and retrieve the
bearer-token
from the generatedconfig.yml
.
- Start the server and retrieve the
Configuration File Description
config.yml
ktor:
http-port: 8080 # HTTP service port.
port-start: 30000 # Starting port for sub-servers.
bearer-token: # Bearer Token; leave this empty on first use.
allow-host: "*" # Allowed host addresses.
docker-compose-default.yml Example
- Use
#SERVER_NAME_PLACEHOLDER
as the placeholder for the Docker container name. - Use
#SERVER_PORT_PLACEHOLDER
as the placeholder for the port.
version: '3.8'
services:
minecraft_server:
image: minecraft-contest:latest
container_name: "#SERVER_NAME_PLACEHOLDER"
ports:
- #SERVER_PORT_PLACEHOLDER:25565
volumes:
# Mount the local world directory to the specified path in the container
- ./worlds/#SERVER_NAME_PLACEHOLDER/world:/app/world
environment:
EULA: "TRUE"
restart: unless-stopped
Usage Instructions
HTTP API
- After the plugin starts, an HTTP service will be launched on port
8080
by default. - Key API endpoint:
- Add Team:
POST /team/add
, requires Bearer Token authentication, withteamId
,teamName
, andmembers
as payload fields.
- Add Team:
Example Request
curl --location --request POST 'http://localhost:8080/team/add' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer sSCj4piDoEfV2zIo_C8lD7S4ul0YlVOyBr2BkKpdsTI (Retrieve this from config.yml)' \
--data-raw '{
"teamId": "team_1",
"teamName": "Team 1",
"members": ["Hanamizu_", "user1"]
}'
External resources
Project members
Hanamizu
Member
Technical information
License
GPL-3.0-or-later
Project ID