docker-minecraft-server icon indicating copy to clipboard operation
docker-minecraft-server copied to clipboard

Ability to specify WHITELIST by UIDs ?

Open cool-mist opened this issue 4 years ago • 2 comments

This avoids updating the env vars when whitelist override is set to true, and an already whitelisted player changes their name

cool-mist avatar Jun 19 '21 14:06 cool-mist

The startup script is using the "whitelist.txt" conversion processed by the minecraft server jar itself.

I'll need help from the community to address your request.

itzg avatar Jun 20 '21 16:06 itzg

#1139 I created a PR with a solution that I've only tested a few times and seems to work on my local machine and my remote server. It uses a public api, but not the official api. Seemed easier, but may want to change it for the official one since no one is ever sure how long a public third party api will last for. I can change the PR to contain the official api at your request, or you can.

Keep in mind, whitelist override set to true will just remove whitelist.json which this PR creates.

The way the change works is just checking if WHITELIST contains a - since usernames cannot contain it, it will then use a different command, which is splitting it by ,, then passing each line into xargs which calls curl to poll playerdb.co with the line, then parse the content of that with jq to format the uuid and username into {"username": "Notch", "uuid": "some-uuid-here"}, which is then fed into jq again to combine all UUID lookups into an array which the whitelist.json uses. I think it's a crude solution but it works.

Please for my sanity, double check everything to see if I've done something stupid or wrong. This is one of the few times I've ever created a PR so go easy on me.

Hi-ImKyle avatar Nov 29 '21 17:11 Hi-ImKyle