From 932a6828f9ccdf02c8bf0f2912daaabf280f8455 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Mon, 3 Jul 2017 14:20:12 -0500 Subject: [PATCH] [mc] Auto fix pre 1.12 empty json For #162 --- minecraft-server/start-minecraft.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index dfc92d79..3e9c2ab5 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -560,11 +560,11 @@ if [ -n "$ICON" -a ! -e server-icon.png ]; then fi fi -# Make sure files exist to avoid errors -if [ ! -e banned-players.json ]; then +# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades) +if [[ ! -e banned-players.json || ! $(jq banned-players.json &> /dev/null) ]]; then echo '[]' > banned-players.json fi -if [ ! -e banned-ips.json ]; then +if [[ ! -e banned-ips.json || ! $(jq banned-ips.json &> /dev/null) ]]; then echo '[]' > banned-ips.json fi