Skip to content

Commit db8546e

Browse files
authored
Updates to Allow/White List handling (#359)
1 parent f2a4dbd commit db8546e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

bedrock-entry.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,23 +165,24 @@ if [ -n "$OPS" ] || [ -n "$MEMBERS" ] || [ -n "$VISITORS" ]; then
165165
]| flatten' > permissions.json
166166
fi
167167

168+
if [[ -n "$ALLOW_LIST_USERS" || -n "$WHITE_LIST_USERS" ]]; then
169+
allowListUsers=${ALLOW_LIST_USERS:-$WHITE_LIST_USERS}
168170

169-
if [[ -v ALLOW_LIST_USERS || -v WHITE_LIST_USERS ]]; then
170-
allowListUsers=${ALLOW_LIST_USERS:-${WHITE_LIST_USERS}}
171-
172-
WHITE_LIST=false
173-
rm -f whitelist.json
174-
if [[ $allowListUsers ]]; then
171+
if [[ "$allowListUsers" ]]; then
175172
echo "Setting allow list"
176173
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "allowlist.json"
177174
# activate server property to enable list usage
178175
ALLOW_LIST=true
179176
else
180-
rm -rf allowlist.json
181177
ALLOW_LIST=false
178+
rm -f allowlist.json
182179
fi
183-
export WHITE_LIST ALLOW_LIST
180+
else
181+
ALLOW_LIST=false
182+
rm -f allowlist.json
184183
fi
184+
sed -i '/^white-list=.*/d' server.properties #Removes white-list= line from server.properties
185+
export ALLOW_LIST
185186

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

0 commit comments

Comments
 (0)