mineforge_html/mods.sh

23 lines
452 B
Bash
Raw Normal View History

2025-01-22 23:36:27 +00:00
#!/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