Handle username and XUID for ALLOW_LIST_USERS (#367)
This commit is contained in:
1 parent
4631a42bbb
commit
6f50e29155
2 files changed
+8
-2
No files matched your search
@@ -151,10 +151,12 @@ There are two ways to handle a whitelist:
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
There are various tools to look XUIDs up online and they are also printed to the log when a player joins the server.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
-e ALLOW_LIST_USERS="player1,player2,player3"
|
-e ALLOW_LIST_USERS="player1:1234567890,player2:0987654321"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Mods Addons
|
## Mods Addons
|
||||||
|
|||||||
@@ -167,7 +167,11 @@ if [[ -n "$ALLOW_LIST_USERS" || -n "$WHITE_LIST_USERS" ]]; then
|
|||||||
|
|
||||||
if [[ "$allowListUsers" ]]; then
|
if [[ "$allowListUsers" ]]; then
|
||||||
echo "Setting allow list"
|
echo "Setting allow list"
|
||||||
|
if [[ "$allowListUsers" != *":"* ]]; then
|
||||||
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "allowlist.json"
|
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "allowlist.json"
|
||||||
|
else
|
||||||
|
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map(split(":") | {"ignoresPlayerLimit":false,"name": .[0], "xuid": .[1]})' > "allowlist.json"
|
||||||
|
fi
|
||||||
# activate server property to enable list usage
|
# activate server property to enable list usage
|
||||||
ALLOW_LIST=true
|
ALLOW_LIST=true
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in new issue
Block a user