Skip to content

someotherotherguy/minecraft-server-hibernation

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minecraft Server Hibernation

msh - release msh - goreport msh - license msh - stars

Avoid wasting of resources by automatically start your minecraft server when a player join and stop it when no one is online
(for vanilla/modded on linux/windows/macos)

version: v2.3.0
Copyright (C) 2019-2021 gekigek99

Check the releases to download the binaries (for linux and windows)


PROGRAM COMPILATION:

This version was successfully compiled in go version 1.15
To compile run the command:

go build .

INSTRUCTIONS:

This is a Golang script to start a minecraft server on request and stop it when there are no players online. How to use:

  1. Install your desired minecraft server
  2. "server-port" parameter in "server.properties" should be 25565
  3. Edit the parameters in config.json as needed (check definitions):
    • serverDirPath
    • serverFileName
    • startMinecraftServer
    • stopMinecraftServer
    • * stopMinecraftServerForce
    • * hibernationInfo and startingInfo
    • * timeBeforeStoppingEmptyServer
    • * checkForUpdates
  4. * put the frozen icon you want in "path/to/server.jar/folder" (must be 64x64 and called "server-icon-frozen.png")
  5. on the server: open port 25555 (example: ufw firewall)
  6. on the router: forward port 25555 to server (tutorial)
  7. you can connect to the server through port 25555

* = it's not compulsory to modify this parameter

(remember to run the script at reboot)

DEFINITIONS:

Commands to start and stop minecraft server:

# only text in braces needs to be modified (remember to remove all braces)
"ServerDirPath": "{path/to/server/folder}",
"ServerFileName": "{server.jar}",
"StartMinecraftServer": "java {-Xmx1024M -Xms1024M} -jar serverFileName nogui",
"StopMinecraftServer": "stop",
"StopMinecraftServerForce": ""

# the StopMinecraftServerForce parameter is used to execute special commands when a forced shutdown happens

Hibernation and warming up server description

"HibernationInfo": "                   &fserver status:\n                   &b&lHIBERNATING",
"StartingInfo": "                   &fserver status:\n                    &6&lWARMING UP",

60 seconds is the time (after the last player disconnected) that the script waits before shutting down the minecraft server

"TimeBeforeStoppingEmptyServer": 60     #any parameter more than 30s is recommended

set to false if you don't want to check for updates

"CheckForUpdates": true

CREDITS:

Author: gekigek99
Contributors: najtin f8ith Br31zh
Docker branch: lubocode


Give a star to this repository here!

About

Autostart and stop minecraft-server when players join/leave

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%