Skip to content

Commit

Permalink
Only remove allowlist.json when ALLOW_LIST_USERS is set to empty stri…
Browse files Browse the repository at this point in the history
…ng (#338)
  • Loading branch information
itzg authored Jul 14, 2023
1 parent a77ed28 commit 8756c97
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions bedrock-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,25 @@ if [ -n "$OPS" ] || [ -n "$MEMBERS" ] || [ -n "$VISITORS" ]; then
]| flatten' > permissions.json
fi

allowListUsers=${ALLOW_LIST_USERS:-${WHITE_LIST_USERS}}

if [ -n "$allowListUsers" ]; then
echo "Setting allow list"
f=allowlist.json
rm -rf "$f"
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "$f"
# activate server property to enable list usage
WHITE_LIST=true
ALLOW_LIST=true
else
rm -rf whitelist.json allowlist.json
: "${WHITE_LIST:=false}"
: "${ALLOW_LIST:=false}"

if [[ -v ALLOW_LIST_USERS || -v WHITE_LIST_USERS ]]; then
allowListUsers=${ALLOW_LIST_USERS:-${WHITE_LIST_USERS}}

if [[ $allowListUsers ]]; then
echo "Setting allow list"
f=allowlist.json
rm -rf "$f"
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "$f"
# activate server property to enable list usage
WHITE_LIST=true
ALLOW_LIST=true
else
rm -rf whitelist.json allowlist.json
WHITE_LIST=false
ALLOW_LIST=false
fi
export WHITE_LIST ALLOW_LIST
fi
export WHITE_LIST ALLOW_LIST

set-property --file server.properties --bulk /etc/bds-property-definitions.json

Expand Down

0 comments on commit 8756c97

Please sign in to comment.