Skip to content

Instantly share code, notes, and snippets.

@KaiserKatze
Created December 24, 2019 13:49
Show Gist options
  • Save KaiserKatze/77490c1fdb5bb8f8e173fba5fa8bef74 to your computer and use it in GitHub Desktop.
Save KaiserKatze/77490c1fdb5bb8f8e173fba5fa8bef74 to your computer and use it in GitHub Desktop.
#!/bin/bash
# TODO check if there is enough memory
MemFree=$(cat /proc/meminfo | grep 'MemFree' | awk '{print $2}')
MemNeed=1048576
if [ $MemFree -lt $MemNeed ]; then
# memory is not enough
dd if=/dev/zero of=/swapfile bs=100M count=10
chmod 0600 /swapfile
mkswap /swapfile
swapon /swapfile
grep "swapon" /etc/rc.local || echo "swapon /swapfile" >> /etc/rc.local
fi
#=============================================================================
# Build Spigot
# @see: https://www.spigotmc.org/wiki/buildtools/#1-14-2
# install prerequisites
apt-get -y install git openjdk-8-jre-headless
# keep watch on https://hub.spigotmc.org/jenkins/job/BuildTools for any bug fixes and updates
curl -sL https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar -o BuildTools.jar
git config --global --unset core.autocrlf
# build spigot
java -Xmx1G -jar BuildTools.jar
# rename spigot jar file
find . -maxdepth 1 -name "spigot*.jar" -exec cp '{}' spigot.jar \;
# run spigot (initialization)
java -Xms1G -Xmx1G -XX:+UseConcMarkSweepGC -jar spigot.jar
sed -i "s/eula=false/eula=true/g" eula.txt
# @see: https://minecraft.gamepedia.com/Server.properties
cat >> server.properties <<-EOF
allow-flight=false
allow-nether=false
difficulty=easy
enable-command-block=false
enable-query=false
enable-rcon=false
force-gamemode=true
gamemode=survival
generate-structures=false
generator-settings=
hardcore=false
level-name=world
level-seed=
level-type=default
max-build-height=256
max-players=8
max-tick-time=60000
max-world-size=29999984
motd=Kaiserreich
network-compression-threshold=256
online-mode=false
op-permission-level=4
player-idle-timeout=10
prevent-proxy-connections=false
pvp=false
query.port=25565
rcon.password=********
rcon.port=25575
resource-pack=
resource-pack-sha1=
server-ip=
server-port=25565
snooper-enabled=true
spawn-animals=true
spawn-monsters=true
spawn-npcs=true
spawn-protection=16
use-native-transport=true
view-distance=10
white-list=false
enforce-whitelist=false
broadcast-console-to-ops=true
broadcast-rcon-to-ops=true
EOF
# @see: http://www.minecraftmaps.com/survival-maps/skyblock/
curl -sL http://www.minecraftmaps.com/survival-maps/skyblock/download -o skyblock.zip
apt-get -y -install unzip
unzip skyblock.zip "Skyblock 2.1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment