diff --git a/minecraft/hooks/init b/minecraft/hooks/init index 8612831..a050204 100755 --- a/minecraft/hooks/init +++ b/minecraft/hooks/init @@ -24,9 +24,19 @@ mem=$(options-get mem) || exit 1 minecraft:init-command "$threads" "$mem" +properties=$(options-get properties) || true whitelist=$(options-get whitelist) || true minecraft:make-whitelist "$whitelist" +if [ -n "$whitelist" ]; then + properties="$( + e "$properties" | + yq '.white-list = true, .enforce-whitelist = true' + )" +fi + ops=$(options-get ops) || true minecraft:make-ops "$ops" + +minecraft:make-properties "$properties" diff --git a/minecraft/lib/common b/minecraft/lib/common index d9f7102..b408405 100644 --- a/minecraft/lib/common +++ b/minecraft/lib/common @@ -63,4 +63,14 @@ minecraft:make-ops() { "bypassesPlayerLimit": .value.bypassesPlayerLimit })' } > "$SERVICE_DATASTORE/${MINECRAFT_DATA}/ops.json" -} \ No newline at end of file +} + +minecraft:make-properties() { + local properties="$1" + + { + e "$properties" | + yq 'to_entries | map(.key + "=" + .value) | .[]' + } > "$SERVICE_DATASTORE/${MINECRAFT_DATA}/server.properties" +} +