Skip to content
Permalink
Browse files

feat(newserver): Minecraft Bedrock (#2626)

  • Loading branch information
dgibbs64 committed Nov 29, 2019
1 parent 75c3238 commit 86478573d973228c3901b26f7314ed5d3fc859bb
@@ -0,0 +1,157 @@
##################################
######## Default Settings ########
##################################
# DO NOT EDIT, ANY CHANGES WILL BE OVERWRITTEN!
# Copy settings from here and use them in either:
# common.cfg - applies settings to every instance.
# [instance].cfg - applies settings to a specific instance.

#### Game Server Settings ####

## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
fn_parms(){
parms=""
}

#### LinuxGSM Settings ####

## LinuxGSM Stats
# Send useful stats to LinuxGSM developers.
# https://docs.linuxgsm.com/configuration/linuxgsm-stats
# (on|off)
stats="off"

## Notification Alerts
# (on|off)

# Display IP | https://docs.linuxgsm.com/alerts#display-ip
displayip=""

# More info | https://docs.linuxgsm.com/alerts#more-info
postalert="off"
postdays="7"
posttarget="https://hastebin.com"

# Discord Alerts | https://docs.linuxgsm.com/alerts/discord
discordalert="off"
discordwebhook="webhook"

# Email Alerts | https://docs.linuxgsm.com/alerts/email
emailalert="off"
email="email@example.com"
emailfrom=""

# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt
iftttalert="off"
ifttttoken="accesstoken"
iftttevent="linuxgsm_alert"

# Mailgun Email Alerts | https://docs.linuxgsm.com/alerts/mailgun
mailgunalert="off"
mailguntoken="accesstoken"
mailgundomain="example.com"
mailgunemailfrom="alert@example.com"
mailgunemail="email@myemail.com"

# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet
pushbulletalert="off"
pushbullettoken="accesstoken"
channeltag=""

# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover
pushoveralert="off"
pushovertoken="accesstoken"

# Slack Alerts | https://docs.linuxgsm.com/alerts/slack
slackalert="off"
slackwebhook="webhook"

# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram
# You can add a custom cURL string eg proxy (useful in Russia) or else in "curlcustomstring".
# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need
# any custom string in curl - simple ignore this parameter.
telegramalert="off"
telegramtoken="accesstoken"
telegramchatid=""
curlcustomstring=""

## Updating | https://docs.linuxgsm.com/commands/update
updateonstart="off"

## Backup | https://docs.linuxgsm.com/commands/backup
maxbackups="4"
maxbackupdays="30"
stoponbackup="on"

## Logging | https://docs.linuxgsm.com/features/logging
consolelogging="on"
logdays="7"

## Monitor | https://docs.linuxgsm.com/commands/monitor
# Query delay time
querydelay="1"

## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors
ansi="on"

#### Advanced Settings ####

## Message Display Time | https://docs.linuxgsm.com/features/message-display-time
sleeptime="0.5"

## Stop Mode | https://docs.linuxgsm.com/features/stop-mode
# 1: tmux kill
# 2: CTRL+c
# 3: quit
# 4: quit 120s
# 5: stop
# 6: q
# 7: exit
# 8: 7 Days to Die
# 9: Gold Source
# 10: Teamspeak 3
stopmode="5"

## Query mode
# 1: session only
# 2: gamedig + gsquery
# 3: gamedig
# 4: gsquery
# 5: tcp
querymode="4"
querytype="minecraftbe"

## Game Server Details
# Do not edit
gamename="Minecraft Bedrock"
engine="bedrock"
glibc="2.27"

#### Directories ####
# Edit with care

## Game Server Directories
systemdir="${serverfiles}"
executabledir="${serverfiles}"
executable="${serverfiles}/bedrock_server"
servercfg="server.properties"
servercfgdefault="server.properties"
servercfgdir="${serverfiles}"
servercfgfullpath="${servercfgdir}/${servercfg}"

## Backup Directory
backupdir="${lgsmdir}/backup"

## Logging Directories
logdir="${rootdir}/log"
gamelogdir="${systemdir}"
lgsmlogdir="${logdir}/script"
consolelogdir="${logdir}/console"
lgsmlog="${lgsmlogdir}/${selfname}-script.log"
consolelog="${consolelogdir}/${selfname}-console.log"
alertlog="${lgsmlogdir}/${selfname}-alert.log"
postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log"

## Logs Naming
lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
@@ -15,6 +15,7 @@ javaram="1024" # -Xmx$1024M
fn_parms(){
parms="nogui"
}

#### LinuxGSM Settings ####

## LinuxGSM Stats
@@ -49,6 +49,7 @@ kf2,kf2server,Killing Floor 2
l4d,l4dserver,Left 4 Dead
l4d2,l4d2server,Left 4 Dead 2
mc,mcserver,Minecraft
mcb,mcbserver,Minecraft Bedrock
mh,mhserver,MORDHAU
mohaa,mohaaserver,Medal of Honor: Allied Assault
mta,mtaserver,Multi Theft Auto
@@ -17,7 +17,7 @@ fn_monitor_check_lockfile(){
fn_print_checking_eol
fn_script_log_info "Checking lockfile: CHECKING"
fn_sleep_time
fn_print_error_nl "Checking lockfile: No lockfile found: "
fn_print_error "Checking lockfile: No lockfile found: "
fn_print_error_eol
fn_script_log_error "Checking lockfile: No lockfile found: ERROR"
fn_sleep_time
@@ -16,6 +16,8 @@ if [ "${shortname}" == "ts3" ]; then
update_ts3.sh
elif [ "${shortname}" == "mc" ]; then
update_minecraft.sh
elif [ "${shortname}" == "mcb" ]; then
update_minecraft_bedrock.sh
elif [ "${shortname}" == "mumble" ]; then
update_mumble.sh
elif [ "${shortname}" == "fctr" ]; then
@@ -81,7 +81,7 @@ fn_dl_extract(){
elif [ "${mime}" == "application/x-xz" ]; then
tarcmd=$(tar -xf "${local_filedir}/${local_filename}" -C "${extractdir}")
elif [ "${mime}" == "application/zip" ]; then
extractcmd=$(unzip -d "${extractdir}" "${local_filedir}/${local_filename}")
extractcmd=$(unzip -dq "${extractdir}" "${local_filedir}/${local_filename}")
fi
local exitcode=$?
if [ ${exitcode} -ne 0 ]; then
@@ -331,6 +331,11 @@ functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

fix_mcb.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

fix_mta.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
@@ -545,6 +550,11 @@ functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

update_minecraft_bedrock.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

update_mumble.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
@@ -67,6 +67,8 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th
fix_terraria.sh
elif [ "${shortname}" == "ts3" ]; then
fix_ts3.sh
elif [ "${shortname}" == "mcb" ]; then
fix_mcb.sh
elif [ "${shortname}" == "mta" ]; then
fix_mta.sh
elif [ "${shortname}" == "unt" ]; then
@@ -0,0 +1,11 @@
#!/bin/bash
# LinuxGSM fix_mcb.sh function
# Author: Daniel Gibbs
# Website: https://linuxgsm.com
# Description: Resolves possible startup issue with Minecraft Bedrock

local commandname="FIX"
local commandaction="Fix"

# official docs state that the server should be started with: LD_LIBRARY_PATH=. ./bedrock_server
export LD_LIBRARY_PATH="${serverfiles}:$LD_LIBRARY_PATH"
@@ -386,6 +386,35 @@ fn_info_config_minecraft(){
fi
}

fn_info_config_minecraft_bedrock(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
maxplayers="${zero}"
port="${zero}"
port6="${zero}"
queryport="${zero}"
gamemode="${unavailable}"
gameworld="${unavailable}"
else
servername=$(grep "server-name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server-name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
maxplayers=$(grep "max-players" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
port=$(grep "server-port\b" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
port6=$(grep "server-portv6\b" "${servercfgfullpath}" | sed 's/v6//g' | grep -v "#" | tr -cd '[:digit:]')
queryport=${port}
gamemode=$(grep "gamemode" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/gamemode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
gameworld=$(grep "level-name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/level-name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')

# Not Set
servername=${servername:-"NOT SET"}
maxplayers=${maxplayers:-"NOT SET"}
port=${port:-"NOT SET"}
port6=${port6:-"NOT SET"}
queryport=${queryport:-"NOT SET"}
gamemode=${gamemode:-"NOT SET"}
gameworld=${gameworld:-"NOT SET"}
fi
}

fn_info_config_mohaa(){
if [ ! -f "${servercfgfullpath}" ]; then
rconpassword="${unavailable}"
@@ -1364,6 +1393,9 @@ elif [ "${shortname}" == "ql" ]; then
# Minecraft
elif [ "${shortname}" == "mc" ]; then
fn_info_config_minecraft
# Minecraft Bedrock
elif [ "${shortname}" == "mcb" ]; then
fn_info_config_minecraft_bedrock
# Post Scriptum: The Bloody Seventh
elif [ "${shortname}" == "pstbs" ]; then
fn_info_config_pstbs
@@ -541,7 +541,7 @@ fn_info_message_ports(){

parmslocation="${red}UNKNOWN${default}"
# engines/games that require editing in the config file
local ports_edit_array=( "avalanche2.0" "avalanche3.0" "Ballistic Overkill" "dontstarve" "Eco" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "Project Cars" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "seriousengine35" "Stationeers" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" "wurm")
local ports_edit_array=( "avalanche2.0" "avalanche3.0" "Ballistic Overkill" "dontstarve" "Eco" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "Minecraft Bedrock" "Project Cars" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "seriousengine35" "Stationeers" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" "wurm")
for port_edit in "${ports_edit_array[@]}"
do
if [ "${shortname}" == "ut3" ]; then
@@ -811,6 +811,16 @@ fn_info_message_minecraft(){
} | column -s $'\t' -t
}

fn_info_message_minecraft_bedrock(){
echo -e "netstat -atunp | grep bedrock_serv"
echo -e ""
{
echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
echo -e "> Game\tINBOUND\t${port}\tudp"
echo -e "> Game\tINBOUND\t${port6}\tudp6"
} | column -s $'\t' -t
}

fn_info_message_mohaa(){
echo -e "netstat -atunp | grep mohaa_lnxded"
echo -e ""
@@ -1368,6 +1378,8 @@ fn_info_message_select_engine(){
fn_info_message_justcause3
elif [ "${shortname}" == "kf2" ]; then
fn_info_message_kf2
elif [ "${shortname}" == "mcb" ]; then
fn_info_message_minecraft_bedrock
elif [ "${shortname}" == "pz" ]; then
fn_info_message_projectzomboid
elif [ "${shortname}" == "pstbs" ]; then
@@ -440,6 +440,12 @@ elif [ "${shortname}" == "mc" ]; then
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${shortname}" == "mcb" ]; then
gamedirname="MinecraftBedrock"
array_configs+=( server.properties )
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${shortname}" == "mohaa" ]; then
gamedirname="MedalOfHonorAlliedAssault"
array_configs+=( server.cfg )
@@ -153,6 +153,8 @@ if [ "${shortname}" == "ts3" ]; then
elif [ "${shortname}" == "mc" ]; then
install_eula.sh
update_minecraft.sh
elif [ "${shortname}" == "mcb" ]; then
update_minecraft_bedrock.sh
elif [ "${shortname}" == "mumble" ]; then
update_mumble.sh
elif [ "${shortname}" == "mta" ]; then
@@ -21,6 +21,7 @@ def __init__(self, options, arguments):
idtech2query=['protocol-quake3','idtech2','quake','iw2.0']
idtech3query=['protocol-quake3','iw3.0','ioquake3','qfusion']
minecraftquery=['minecraft','lwjgl2']
minecraftbequery=['minecraftbe']
jc2mpquery=['jc2mp']
mumblequery=['mumbleping']
twquery=['teeworlds']
@@ -32,10 +33,12 @@ def __init__(self, options, arguments):
self.query_prompt_string = b'\xff\xff\xff\xffstatus\x00'
elif self.option.engine in idtech3query:
self.query_prompt_string = b'\xff\xff\xff\xffgetstatus'
elif self.option.engine in minecraftquery:
self.query_prompt_string = b'\xFE\xFD\x09\x3d\x54\x1f\x93'
elif self.option.engine in jc2mpquery:
self.query_prompt_string = b'\xFE\xFD\x09\x10\x20\x30\x40'
elif self.option.engine in minecraftquery:
self.query_prompt_string = b'\xFE\xFD\x09\x3d\x54\x1f\x93'
elif self.option.engine in minecraftbequery:
self.query_prompt_string = b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78\x00\x00\x00\x00\x00\x00\x00\x00'
elif self.option.engine in mumblequery:
self.query_prompt_string = b'\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08'
elif self.option.engine in unrealquery:
@@ -113,7 +116,7 @@ def sanity_checks(self):
action='store',
dest='engine',
default=False,
help='Engine type: protocol-valve protocol-quake3 protocol-quake3 protocol-gamespy1 protocol-unreal2 minecraft jc2mp mumbleping teeworlds'
help='Engine type: protocol-valve protocol-quake3 protocol-quake3 protocol-gamespy1 protocol-unreal2 minecraft minecraftbe jc2mp mumbleping teeworlds'
)
parser.add_option(
'-v', '--verbose',
@@ -64,7 +64,7 @@ fn_update_minecraft_localbuild(){
fi

if [ -z "${localbuild}" ]; then
localbuild=$(cat "${serverfiles}/logs/latest.log" 2> /dev/null | grep version | grep -Eo '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
localbuild=$(grep version "${serverfiles}/logs/latest.log" | grep -Eo '((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}')
fi

if [ -z "${localbuild}" ]; then

0 comments on commit 8647857

Please sign in to comment.
You can’t perform that action at this time.