add current players script

This commit is contained in:
Paul Wilde 2025-01-22 23:36:27 +00:00
parent 9402575a3a
commit bc6c49107b

22
mods.sh Normal file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env sh
world=/opt/luanti/worlds/paultopia
moddir=/opt/luanti/mods
while true
do
mods=$(grep -o -E "load_mod_[a-zA-Z0-9\_\-]+ ?= ?true" $world/world.mt | grep -o -E "load_mod_[a-zA-Z0-9\_\-]+")
my_mods="["
c=""
for mod in $mods; do
name=$(echo $mod | sed -e 's/load_mod_//g')
my_mods="$my_mods$c{\"name\":\"$name\"}"
if [ "$c" = "" ]; then
c=","
fi
done
my_mods="$my_mods]"
echo $my_mods | jq > mods.json
sleep 600
done