This is a fork of TheRemote/Legendary-Java-Minecraft-Geyser-Floodgate with an included discord bot that allows people to start and stop the server at will (the server auto shutsdown after a defined period).
The server uses PaperMC and has preconfigured plugins to allow bedrock people to play and authenticate (using geyser and floodgate).
The discord bot is written in golang (please dont judge my code, its awful because I made it really quickly - I also have no intention to add additional features or 'fix' my bad code because it does its job)
Please note that the Worlds
field is custom (its been added using the ADDITIONAL_MESSAGES_FOR_EMBED
environment variable)
To use a pre-built image use ghcr.io/tywil04/minecraft-with-discordbot-docker
. This image uses environment variables as the main method for configuring the container, there are however configuration files for the server that are stored within its volume that can be modified if so desired. I would recommend using a path on the host machine instead of a docker volume because its easier to access your files that way which will be useful and almost certainly required at some point.
The default ports that are exposed and required (they can be changed via the environment variables below):
25565
for Java19132
for Bedrock19132/udp
for Bedrock
If you want your minecraft server to store its config (you most likely do) then you will need to use a volume that links to /minecraft
in the container.
With default ports:
docker run -it -v /path/on/host:/minecraft -p 25565 -p 19132 -p 19132/udp --restart unless-stopped ghcr.io/tywil04/minecraft-with-discordbot-docker
As with most docker containers, its really easy to build.
Start by cloning this repo:
git clone https://github.com/tywil04/minecraft-docker
Enter the repo:
cd minecraft-docker
Build with tag:
sudo docker build . -t your-tag-here
For the configuration of environment variables for the discord bot only I recommend using a docker volume. The discord bot loads environment variables from a .env
file located at /
/path/to/discordbot.env:/.env
Set port environment variable. Default is 25565
.
Set Bedrock port environment variable. Default is 19132
.
Optional maximum memory Minecraft is allowed to use
Optional Paper Minecraft Version override. Default is 1.20.1
.
Optional Timezone. Default is Europe/London
.
Optional folder to ignore during backup operations
Number of rolling backups to keep. Default is 10.
Optional switch to skip permissions check.
Optional switch to tell curl to suppress the progress meter which generates much less noise in the logs. Default is true.
Optional switch to disable ViaVersion
Discord Bot Token. Needs to be set for discord bot to work.
Discord Application Id. Needs to be set for discord bot to work.
Guild Id (can be blank but it will take a bit for commands to register globally - this is a limitation of discord).
The person who 'owns' the bot (the only one who can run the command to create the message that allows for starting/stopping server). Needs to be set or nobody can use the bot.
The address for accessing the bedrock minecraft server like mc.example.org. Needs to be set or a the discord bot will look strange.
The port for accessing the bedrock minecraft server. Default is 19132
. This uses a seperate environment variable because the port users connect with might be different to the port within the container.
The address for accessing the java minecraft server like mc.example.org. Needs to be set or a the discord bot will look strange.
The port for accessing the java minecraft server. Default is 25565
. This uses a seperate environment variable because the port users connect with might be different to the port within the container.
The minecraft version so the discord bot can display it. Required otherwise bot will look odd.
The discord channel in which to log who starts/stops the server, leave blank for it to be disabled.
The timeout between starting/stopping the server. Default is 30
seconds.
How long it takes for the server to automatically shutdown once empty. Default is 30
minutes.
Additional fields to add to the embed created by the /minecraft command
Format is Fieldname::Content;;Fieldname::Content
where ::
seperates fieldname from content and ;;
seperates fields