Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,14 @@ To whitelist players for your Minecraft server, pass the Minecraft usernames sep

docker run -d -e WHITELIST=user1,user2 ...

or

docker run -d -e WHITELIST=uuid1,uuid2 ...

If the `WHITELIST` environment variable is not used, any user can join your Minecraft server if it's publicly accessible.

> NOTE: When using uuids in the whitelist, please make sure it is the dashed variant otherwise it will not parse correctly.

> NOTE: When `WHITELIST` is used the server properties `white-list` and `whitelist` will automatically get set to `true`.

> By default, the players in `WHITELIST` are **added** to the final `whitelist.json` file by the Minecraft server. If you set `OVERRIDE_WHITELIST` to "true" then the `whitelist.json` file will be recreated on each server startup.
Expand Down
6 changes: 5 additions & 1 deletion scripts/start-finalExec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ fi
if [ -n "$WHITELIST" ]; then
log "Updating whitelist"
rm -f /data/white-list.txt.converted
echo $WHITELIST | awk -v RS=, '{print}' > /data/white-list.txt
if [[ $WHITELIST == *"-"* ]]; then
echo $WHITELIST | awk -v RS=, '{print}' | xargs -l -i curl -s https://playerdb.co/api/player/minecraft/{} | jq -r '.["data"]["player"] | {"uuid": .id, "name": .username}' | jq -s . > "whitelist.json"
else
echo $WHITELIST | awk -v RS=, '{print}' > /data/white-list.txt
fi
fi
if isTrue "${OVERRIDE_WHITELIST}"; then
log "Recreating whitelist.json file at server startup"
Expand Down