first commit

main
Soper Aylamo 2021-12-26 22:49:30 -05:00
commit 50da19a9a1
Signed by: Soper
GPG Key ID: A27AC885ACC3BEAE
7 changed files with 104 additions and 0 deletions

9
LICENSE Normal file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

39
README.md Normal file
View File

@ -0,0 +1,39 @@
# Minecraft Server Template
This is a handful of important files, as well as some that make it easier for server administration, that I personally use for my Minecraft servers.
To use this, just clone this repository, and edit the necessary files.
## Usage & Disclaimers
### Minecraft EULA
The usage of this repository implies that you have agreed to the Minecraft EULA, which is necessary to run a Minecraft server. You can read that here:
https://account.mojang.com/documents/minecraft_eula
### Server launch scripts
The `start.bat` and `start.sh` files are simple scripts that automate the launching of the Minecraft server, without having to manually type in
```sh
java -jar server.jar
```
When using either file, you must change the appropriate variable to the name of the server jar you are using. For example, if you are using the [vanilla server jar](https://www.minecraft.net/en-us/download/server), you must change the `jarfile` variable to `minecraft_server.VERSION.jar`.
### Service File
This file is used by Linux distributions that come with systemd. This file allows you to create a system service which allows you to control your Minecraft server via systemd commands.
To use this file, you must be using a Linux distribution with `systemd` and `screen` installed. Most users can install `screen` via their distribution's package manager.
Rename the file to something along the lines of `mc-server.service` (mc-server being whatever you choose to name it). Then, edit the file and replace everything in brackets `[]`, which should just be
```
[SERVER_NAME]
[SERVER_DIRECTORY]
[USERNAME]
[SHORT_SERVER_NAME]
```
Now, you can register this file with systemd by using
```sh
systemctl enable /path/of/service_file.service
```
### info.yaml
The `info.yaml` file is used for administrators to better distinguish and organize their own Minecraft servers. I have found myself constantly juggling between a bunch of servers I previously created that I don't remember about. This file makes it easier to organize and prevent that situation. It is *not* necessary to use to run a server, and is entirely optional.
Some server jars may use the `info.yaml` for other purposes. If that is the case for you, you may delete the `info.yaml` file that comes with this repository, or rename it if you find it useful.

2
eula.txt Normal file
View File

@ -0,0 +1,2 @@
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).
eula=true

26
info.yaml Normal file
View File

@ -0,0 +1,26 @@
#This is an info file for general information
#Makes it easier to differentiate between servers
#Version 1.0
server-name: #server name
basic-info: #general information
description: #server MOTD/description
mc-version: #change this to current minecraft version of server jar
server-info: #behind-the-scenes info
ip: #server address
port: 25565 #server port; minecraft defaults to 25565
srv: true #change to false if this server does not have a SRV DNS record
is-modded: false
is-public: true
whitelist: #["user1","user2"]
server-jar: #server jar currently in use
meta-info: #Info about info
created-on: 0000-00-00 00:00:00
created-by: #who created this server
created-ver: #version of minecraft server was created on
deploy-date: 0000-00-00 00:00:00 #day server was opened to public
deploy-jar: #server jar the server deployed with
is-retired: false #change to false if server is not meant to be active
retired-on: #0000-00-00
retired-ver: #version of minecraft server was retired on
retire-jar: #server jar the server was retired with

View File

@ -0,0 +1,19 @@
[Unit]
Description=[SERVER NAME]
After=local-fs.target network.target
[Service]
WorkingDirectory=[SERVER DIRECTORY]
User=USERNAME
Group=USERNAME
Type=forking
Environment="SERVERNAME=#Short Server Name"
ExecStart=/usr/bin/screen -dmS $SERVERNAME -t console ./start.sh
ExecStop=/usr/bin/screen -p console -S $SERVERNAME -X eval 'stuff \015' 'stuff \"stop\"\015'
ExecStop=/bin/bash -c "while ps -p $MAINPID > /dev/null; do /bin/sleep 1; done"
[Install]
WantedBy=multi-user.target

3
start.bat Normal file
View File

@ -0,0 +1,3 @@
set jarfile=server_jar_name.jar
java -Xmx8G -Xms3G -jar %jarfile% nogui -o true
PAUSE

6
start.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
jarfile="JARFILE"
cd "${0%/*}"
echo "${0%/*}"
java -Xmx8G -Xms3G -jar "$jarfile" nogui -o true