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.
This commit is contained in:
ATMD 2017-06-29 21:53:26 +02:00 committed by GitHub
parent f875af5cdb
commit 0195b42eea

View file

@ -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