playerdb.co/api

This commit is contained in:
Roger 2025-01-15 23:57:40 -05:00
parent 1a2c720c66
commit a3db683828

View file

@ -49,16 +49,19 @@ fi
if [[ -n "$ONLINE_MODE" ]]; then
sed -i "s/online-mode=.*/online-mode=$ONLINE_MODE/" /data/server.properties
fi
# Initialize whitelist
echo "[]" > whitelist.json
IFS=',' read -ra USERS <<< "$WHITELIST_USERS"
for raw_username in "${USERS[@]}"; do
username=$(echo "$raw_username" | xargs)
if [[ ! "$username" =~ ^[a-zA-Z0-9_]{3,16}$ ]]; then
echo "Whitelist: Invalid username: '$username'. Skipping..."
continue
fi
UUID=$(curl -s "https://api.minetools.eu/uuid/$username" | jq -r '.id')
UUID=$(curl -s "https://playerdb.co/api/player/minecraft/$username" | jq -r '.data.player.id')
if [[ "$UUID" != "null" ]]; then
if jq -e ".[] | select(.uuid == \"$UUID\")" whitelist.json > /dev/null; then
echo "Whitelist: $username ($UUID) is already whitelisted."
@ -71,16 +74,19 @@ for raw_username in "${USERS[@]}"; do
echo "Whitelist: Failed to fetch UUID for $username."
fi
done
# Initialize ops
echo "[]" > ops.json
IFS=',' read -ra OPS <<< "$OP_USERS"
for raw_username in "${OPS[@]}"; do
username=$(echo "$raw_username" | xargs)
if [[ ! "$username" =~ ^[a-zA-Z0-9_]{3,16}$ ]]; then
echo "Ops: Invalid username: '$username'. Skipping..."
continue
fi
UUID=$(curl -s "https://api.minetools.eu/uuid/$username" | jq -r '.id')
UUID=$(curl -s "https://playerdb.co/api/player/minecraft/$username" | jq -r '.data.player.id')
if [[ "$UUID" != "null" ]]; then
if jq -e ".[] | select(.uuid == \"$UUID\")" ops.json > /dev/null; then
echo "Ops: $username ($UUID) is already an operator."