From 0195b42eeab10d786a1fb723ae6466ef978f6c49 Mon Sep 17 00:00:00 2001 From: ATMD Date: Thu, 29 Jun 2017 21:53:26 +0200 Subject: [PATCH] Fix regex to change gamemode value The sed command `sed -i "/gamemode\s*=/ c gamemode=$MODE" $SERVER_PROPERTIES` matches all lines containing `gamemode=`. This includes the line `force-gamemode` that is set it with `setServerProp "force-gamemode" "$FORCE_GAMEMODE"` So basically the `force-gamemode` line is erased and the `gamemode=value` line is duplicated, and then the server cleans it up at start and deduplicates the `gamemode` line and create a new `force-gamemode` line with a default value. This fix ensures that only the `gamemode=` line is modified when changing the gamemode value. --- minecraft-server/start-minecraft.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index 268b1cdb..bc2f9ce5 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -526,7 +526,7 @@ if [ ! -e server.properties ]; then ;; esac - sed -i "/gamemode\s*=/ c gamemode=$MODE" $SERVER_PROPERTIES + sed -i "/^gamemode\s*=/ c gamemode=$MODE" $SERVER_PROPERTIES fi fi