mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Added UUID Support for WHITELIST (#1139)
This commit is contained in:
parent
263a10848a
commit
75dcc746f8
@ -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.
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user