Adding permissions.json creation to bedrock server startup (#102)

This commit is contained in:
Mike Wilson authored and GitHub committed 2020-10-29 14:04:56 -05:00
1 parent 2b9e8f8aed
commit ee8467a518
2 files changed
+33

No files matched your search

+18
View File
@@ -116,6 +116,24 @@ in the "LAN Games" part of the "Friends" tab, such as:
![](docs/example-client.jpg) ![](docs/example-client.jpg)
## Permissions
The Bedrock Dedicated Server requires permissions be defined with XUIDs. There are various tools to look these up online and they
are also printed to the log when a player joins. There are 3 levels of permissions and 3 options to configure each group:
- `OPS` is used to define operators on the server.
```shell
-e OPS "1234567890,0987654321"
```
- `MEMBERS` is used to define the members on the server.
```shell
-e MEMBERS "1234567890,0987654321"
```
- `VISITORS` is used to define visitors on the server.
```shell
-e VISITORS "1234567890,0987654321"
```
## Whitelist ## Whitelist
The whitelist works with player names. The server will look up the names and add in the XUID to match the player. The whitelist works with player names. The server will look up the names and add in the XUID to match the player.
+15
View File
@@ -94,6 +94,21 @@ if [ ! -f "bedrock_server-${VERSION}" ]; then
mv bedrock_server bedrock_server-${VERSION} mv bedrock_server bedrock_server-${VERSION}
fi fi
if [ -n "$OPS" ] || [ -n "$MEMBERS" ] || [ -n "$VISITORS" ]; then
echo "Updating permissions"
echo "[" > permissions.json
if [ -n "$OPS" ]; then
echo $OPS | awk -v RS=, '{print "{ \"permission\": \"operator\", \"xuid\": \"" $1 "\" },"}' >> permissions.json
fi
if [ -n "$MEMBERS" ]; then
echo $MEMBERS | awk -v RS=, '{print "{ \"permission\": \"member\", \"xuid\": \"" $1 "\" },"}' >> permissions.json
fi
if [ -n "$VISITORS" ]; then
echo $VISITORS | awk -v RS=, '{print "{ \"permission\": \"visitor\", \"xuid\": \"" $1 "\" },"}' >> permissions.json
fi
echo "]" >> permissions.json
fi
if [ -n "$WHITE_LIST" ]; then if [ -n "$WHITE_LIST" ]; then
echo "Setting whitelist" echo "Setting whitelist"
rm -rf whitelist.json rm -rf whitelist.json