From 76c251d8bdfe6b8d06e53599d5fc5b30ce632e32 Mon Sep 17 00:00:00 2001 From: kuesta <1512225+kuesta@users.noreply.github.com> Date: Mon, 18 Mar 2024 02:37:11 +0100 Subject: [PATCH] set ip port and modt by ui configuration with the install, the ip port and modt is now written to velocity.yml if it's not already present a pre-run hook updating the velocity.yml file if it's already existing Resolves: https://github.com/pufferpanel/templates/issues/258 --- minecraft-velocity/minecraft-velocity.json | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/minecraft-velocity/minecraft-velocity.json b/minecraft-velocity/minecraft-velocity.json index ef7eff58..2a67e35c 100644 --- a/minecraft-velocity/minecraft-velocity.json +++ b/minecraft-velocity/minecraft-velocity.json @@ -68,6 +68,12 @@ "type": "move", "source": "velocity-*.jar", "target": "velocity.jar" + }, + { + "if": "!file_exists(\"velocity.toml\")", + "type": "writefile", + "target": "velocity.toml", + "text": "bind = \"${ip}:${port}\"\nmotd = \"${motd}\"" } ], "run": { @@ -81,6 +87,24 @@ } ], "stop": "shutdown", + "pre": [ + { + "if": "file_exists(\"velocity.toml\")", + "type": "alterfile", + "replace": "bind = \"${ip}:${port}\"", + "file": "velocity.toml", + "regex": true, + "search": "(bind = .*:\\w*\")" + }, + { + "if": "file_exists(\"velocity.toml\")", + "type": "alterfile", + "regex": true, + "search": "(motd = \".*\")", + "replace": "motd = \"${motd}\"", + "file": "velocity.toml" + } + ], "stdin": { "type": "stdin" },