Skip to content

Commit

Permalink
dev v2.0.0 -> master
Browse files Browse the repository at this point in the history
version v2.0.0 release
  • Loading branch information
gekigek99 authored Nov 15, 2020
2 parents a7cc6c0 + 0fb5035 commit b68cc65
Show file tree
Hide file tree
Showing 5 changed files with 922 additions and 740 deletions.
96 changes: 68 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,64 @@
# Minecraft Server Hibernation
# Minecraft Server Hibernation

[![mvsh - license](https://img.shields.io/github/license/gekigek99/minecraft-server-hibernation?color=6fff00)](https://github.com/gekigek99/minecraft-vanilla-server-hibernation)
[![mvsh - stars](https://img.shields.io/github/stars/gekigek99/minecraft-server-hibernation?color=ffbd19)](https://github.com/gekigek99/minecraft-vanilla-server-hibernation)
[![mvsh - release](https://img.shields.io/github/release/gekigek99/minecraft-server-hibernation?color=05aefc)](https://github.com/gekigek99/minecraft-vanilla-server-hibernation)
[![msh - license](https://img.shields.io/github/license/gekigek99/minecraft-server-hibernation?color=6fff00)](https://github.com/gekigek99/minecraft-vanilla-server-hibernation)
[![msh - stars](https://img.shields.io/github/stars/gekigek99/minecraft-server-hibernation?color=ffbd19)](https://github.com/gekigek99/minecraft-vanilla-server-hibernation)
[![msh - release](https://img.shields.io/github/release/gekigek99/minecraft-server-hibernation?color=05aefc)](https://github.com/gekigek99/minecraft-vanilla-server-hibernation)

[![mvsh - logo](https://user-images.githubusercontent.com/53654579/90397372-09a9df80-e098-11ea-925c-29e9bdfc0b48.png)](https://github.com/gekigek99/minecraft-server-hibernation)
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)_

Release version: 9.12 (Python - Go)
The program supports minecraft vanilla and modded on linux and windows!
<p align="center" >
<a href="https://github.com/gekigek99/minecraft-server-hibernation" >
<img src="https://user-images.githubusercontent.com/53654579/90397372-09a9df80-e098-11ea-925c-29e9bdfc0b48.png" >
</a>
</p>

-----
#### Vote for adding optional financial support possibilities:
https://linkto.run/p/BXYKPR5Y \
Results: https://linkto.run/r/BXYKPR5Y
version: v2.0.0
Copyright (C) 2019-2020 [gekigek99](https://github.com/gekigek99)

Check the [releases](https://github.com/gekigek99/minecraft-server-hibernation/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 minecraft-server-hibernation.go
```

-----
### INSTRUCTIONS:
This is a Golang script to start a minecraft server on request and stop it when there are no player online.
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
- startMinecraftServerLin or startMinecraftServerWin
- stopMinecraftServerLin or stopMinecraftServerWin
- minecraftServerStartupTime
- timeBeforeStoppingEmptyServer
4. on the server: open port 25555 (example: [ufw firewall](https://www.configserverfirewall.com/ufw-ubuntu-firewall/ubuntu-firewall-open-port/))
5. on the router: forward port 25555 to server ([tutorial](https://www.wikihow.com/Open-Ports#Opening-Router-Firewall-Ports))
6. you can connect to the server through port 25555
- *hibernationInfo and startingInfo
- *minecraftServerStartupTime
- *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](https://www.configserverfirewall.com/ufw-ubuntu-firewall/ubuntu-firewall-open-port/))
6. on the router: forward port 25555 to server ([tutorial](https://www.wikihow.com/Open-Ports#Opening-Router-Firewall-Ports))
7. you can connect to the server through port 25555

\* = this step is NOT strictly necessary

(remember to run the script at reboot)

### DEFINITIONS:
Commands to start and stop minecraft server:
```yaml
# only text in parethesis needs to be modified
"startMinecraftServerLin": "cd {PATH/TO/SERVERFOLDER}; screen -dmS minecraftServer java {-Xmx1024M} {-Xms1024M} -jar {server.jar} nogui",
"serverDirPath": "{path/to/server/folder}",
"serverFileName": "{server.jar}",
"startMinecraftServerLin": "screen -dmS minecraftServer java {-Xmx1024M -Xms1024M} -jar serverFileName nogui",
"stopMinecraftServerLin": "screen -S minecraftServer -X stuff 'stop\\n'",
"startMinecraftServerWin": "java {-Xmx1024M} {-Xms1024M} -jar {server.jar} nogui",
"startMinecraftServerWin": "java {-Xmx1024M -Xms1024M} -jar serverFileName nogui",
"stopMinecraftServerWin": "stop",

# if you are on linux you can access the minecraft server console with "sudo screen -r minecraftServer"
Expand All @@ -48,24 +68,44 @@ Personally I set up a systemctl minecraft server service (called "minecraft-serv
"startMinecraftServerLin": "sudo systemctl start minecraft-server",
"stopMinecraftServerLin": "sudo systemctl stop minecraft-server",
```
If you are the first to access to minecraft world you will have to wait *30 seconds* and then try to connect again.
Hibernation and warming up server description
```yaml
"minecraftServerStartupTime": 30, #any parameter more than 10s is recommended
"hibernationInfo": " &fserver status:\n &b&lHIBERNATING",
"startingInfo": " &fserver status:\n &6&lWARMING UP",
```
*120 seconds* is the time (after the last player disconnected) that the script waits before shutting down the minecraft server
If you are the first to access to minecraft world you will have to wait *20 seconds* and then try to connect again.
```yaml
"timeBeforeStoppingEmptyServer": 120 #any parameter more than 60s is recommended
```
"minecraftServerStartupTime": 20, #any parameter more than 10s is recommended
```
*60 seconds* is the time (after the last player disconnected) that the script waits before shutting down the minecraft server
```yaml
"timeBeforeStoppingEmptyServer": 60 #any parameter more than 30s is recommended
```
set to false if you don't want to check for updates
```yaml
"checkForUpdates": true
```
-----
### CREDITS:
Author: [gekigek99](https://github.com/gekigek99)
Contributors: [najtin](https://github.com/najtin/minecraft-server-hibernation)
Docker branch: [lubocode](https://github.com/gekigek99/minecraft-server-hibernation/tree/docker)
#### If you like what I do please consider having a cup of coffee with me at:
-----
<p align="center" >
<a href="https://www.buymeacoffee.com/gekigek99" >
<img src="https://user-images.githubusercontent.com/53654579/98535501-81963900-2286-11eb-94a4-359adb64afe2.png" >
</a>
</p>
<a href="https://www.buymeacoffee.com/gekigek99" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
<h4 align="center" >
Give a star to this repository <a href="https://github.com/gekigek99/minecraft-server-hibernation" > here</a>!
</h4>
#### And remember to give a star to this repository [here](https://github.com/gekigek99/minecraft-server-hibernation)!
<p align="center" >
<a href="https://github.com/gekigek99/minecraft-server-hibernation/stargazers" >
<img src="https://reporoster.com/stars/gekigek99/minecraft-server-hibernation" >
</a>
</p>
15 changes: 9 additions & 6 deletions go-script/config.json → config.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
{
"tomodify": {
"startMinecraftServerLin": "cd {PATH/TO/SERVERFOLDER}; screen -dmS minecraftServer java {-Xmx1024M} {-Xms1024M} -jar {server.jar} nogui",
"basic": {
"serverDirPath": "{path/to/server/folder}",
"serverFileName": "{server.jar}",
"startMinecraftServerLin": "screen -dmS minecraftServer java {-Xmx1024M -Xms1024M} -jar serverFileName nogui",
"stopMinecraftServerLin": "screen -S minecraftServer -X stuff 'stop\\n'",
"startMinecraftServerWin": "java -Xmx1024M -Xms1024M -jar server.jar nogui",
"startMinecraftServerWin": "java {-Xmx1024M -Xms1024M} -jar serverFileName nogui",
"stopMinecraftServerWin": "stop",
"hibernationInfo": " &fserver status:\n &b&lHIBERNATING",
"startingInfo": " &fserver status:\n &6&lWARMING UP",
"minecraftServerStartupTime": 20,
"timeBeforeStoppingEmptyServer": 60
"timeBeforeStoppingEmptyServer": 60,
"checkForUpdates": true
},
"advanced": {
"listenHost": "0.0.0.0",
"listenPort": "25555",
"targetHost": "127.0.0.1",
"targetPort": "25565",
"debug": false,
"serverVersion": "1.16.3",
"serverProtocol": "753"
"serverVersion": "1.16.4",
"serverProtocol": "754"
}
}
14 changes: 0 additions & 14 deletions go-script/README.md

This file was deleted.

Loading

0 comments on commit b68cc65

Please sign in to comment.