Skip to content

Commit 6f50e29

Browse files
authored
Handle username and XUID for ALLOW_LIST_USERS (#367)
1 parent 4631a42 commit 6f50e29

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,12 @@ There are two ways to handle a whitelist:
151151

152152
The first is to set the `ALLOW_LIST` environment variable to true and map in an [allowlist.json](https://minecraft.wiki/w/Whitelist.json) file (previously known as "whitelist.json") that is custom-crafted to the container.
153153

154-
The other is to set the `ALLOW_LIST_USERS` environment variable to a comma-separated list of gamer tag usernames that should be allowed. The server will look up the names and add in the XUID to match the player.
154+
The other is to set the `ALLOW_LIST_USERS` environment variable to a comma-separated list of gamer tag usernames and their corresponding XUIDs. Each username should be followed by its XUID, separated by a colon. The server will use these details to match the player.
155+
156+
There are various tools to look XUIDs up online and they are also printed to the log when a player joins the server.
155157

156158
```shell
157-
-e ALLOW_LIST_USERS="player1,player2,player3"
159+
-e ALLOW_LIST_USERS="player1:1234567890,player2:0987654321"
158160
```
159161

160162
## Mods Addons

bedrock-entry.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ if [[ -n "$ALLOW_LIST_USERS" || -n "$WHITE_LIST_USERS" ]]; then
167167

168168
if [[ "$allowListUsers" ]]; then
169169
echo "Setting allow list"
170-
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "allowlist.json"
170+
if [[ "$allowListUsers" != *":"* ]]; then
171+
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "allowlist.json"
172+
else
173+
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map(split(":") | {"ignoresPlayerLimit":false,"name": .[0], "xuid": .[1]})' > "allowlist.json"
174+
fi
171175
# activate server property to enable list usage
172176
ALLOW_LIST=true
173177
else

0 commit comments

Comments
 (0)