mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Fixing missing export, fixed run order, added real world working example (#1397)
This commit is contained in:
parent
b1e00b43be
commit
ba08a5d8f1
@ -9,22 +9,28 @@ services:
|
||||
- "mc:/data"
|
||||
environment:
|
||||
EULA: "TRUE"
|
||||
TYPE: FABRIC
|
||||
MODS_FORGEAPI_PROJECTIDS: 433175
|
||||
MODS_FORGEAPI_KEY: ${MODS_FORGEAPI_KEY}
|
||||
MODS_FORGEAPI_DOWNLOAD_DEPENDENCIES: "TRUE"
|
||||
REMOVE_OLD_FORGEAPI_MODS: "TRUE"
|
||||
# YAML Heredoc, be sure to use '|-' this will remove the first newline and final new line.
|
||||
# This is versus '|' that will leaving with two empty strings at top and bottom.
|
||||
RCON_CMDS_STARTUP: |-
|
||||
/pregen start 200
|
||||
/gamerule doFireTick false
|
||||
/team add New
|
||||
/team add Old
|
||||
/chunky radius 1000
|
||||
/chunky start
|
||||
RCON_CMDS_ON_CONNECT: |-
|
||||
/team join New @a[team=]
|
||||
/give @a[team=New] birch_boat
|
||||
/team join Old @a[team=New]
|
||||
RCON_CMDS_FIRST_CONNECT: |-
|
||||
/pregen stop
|
||||
/chunky pause
|
||||
RCON_CMDS_LAST_DISCONNECT: |-
|
||||
/kill @e[type=minecraft:boat]
|
||||
/pregen start 200
|
||||
/chunky continue
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
mc: {}
|
||||
|
@ -60,6 +60,15 @@ do
|
||||
;;
|
||||
XII)
|
||||
CURR_CLIENTCONNECTIONS=$(java_clients_connections)
|
||||
# First client connection
|
||||
# Setting priority run order: on first client connection is usually to STOP maintence, aka DO THIS FIRST
|
||||
if (( CURR_CLIENTCONNECTIONS > 0 )) && (( CLIENTCONNECTIONS == 0 )) && [[ "$RCON_CMDS_FIRST_CONNECT" ]]; then
|
||||
logRcon "First Clients has Connected, running first connect cmds"
|
||||
while read -r cmd; do
|
||||
run_command "$cmd"
|
||||
done <<< "$RCON_CMDS_FIRST_CONNECT"
|
||||
fi
|
||||
|
||||
# When a client joins
|
||||
if (( CURR_CLIENTCONNECTIONS > CLIENTCONNECTIONS )) && [[ "$RCON_CMDS_ON_CONNECT" ]]; then
|
||||
logRcon "Clients have Connected, running connect cmds"
|
||||
@ -74,14 +83,9 @@ do
|
||||
done <<< "$RCON_CMDS_ON_DISCONNECT"
|
||||
fi
|
||||
|
||||
# First client connection
|
||||
if (( CURR_CLIENTCONNECTIONS > 0 )) && (( CLIENTCONNECTIONS == 0 )) && [[ "$RCON_CMDS_FIRST_CONNECT" ]]; then
|
||||
logRcon "First Clients has Connected, running first connect cmds"
|
||||
while read -r cmd; do
|
||||
run_command "$cmd"
|
||||
done <<< "$RCON_CMDS_FIRST_CONNECT"
|
||||
# Last client connection
|
||||
elif (( CURR_CLIENTCONNECTIONS == 0 )) && (( CLIENTCONNECTIONS > 0 )) && [[ "$RCON_CMDS_LAST_DISCONNECT" ]]; then
|
||||
# Setting priority run order: on last client connection is usually to START maintence, aka DO THIS LAST
|
||||
if (( CURR_CLIENTCONNECTIONS == 0 )) && (( CLIENTCONNECTIONS > 0 )) && [[ "$RCON_CMDS_LAST_DISCONNECT" ]]; then
|
||||
logRcon "ALL Clients have Disconnected, running last disconnect cmds"
|
||||
while read -r cmd; do
|
||||
run_command "$cmd"
|
||||
|
@ -13,6 +13,7 @@
|
||||
export RCON_CMDS_STARTUP
|
||||
export RCON_CMDS_ON_CONNECT
|
||||
export RCON_CMDS_ON_DISCONNECT
|
||||
export RCON_CMDS_FIRST_CONNECT
|
||||
export RCON_CMDS_LAST_DISCONNECT
|
||||
export RCON_CMDS_PERIOD
|
||||
export SERVER_PORT
|
||||
|
Loading…
Reference in New Issue
Block a user