From e460105bcd754657680685869c6276e5e50eaca4 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 2 May 2023 13:51:49 +0100 Subject: [PATCH] fix quakec --- lgsm/modules/info_game.sh | 18 ++++++++++++++++-- package-lock.json | 14 +++++++------- package.json | 2 +- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/lgsm/modules/info_game.sh b/lgsm/modules/info_game.sh index 6b8052e91..7f37fe3a4 100644 --- a/lgsm/modules/info_game.sh +++ b/lgsm/modules/info_game.sh @@ -46,7 +46,7 @@ fn_info_game_quakec() { if [ -n "${3}" ]; then servercfgfullpath="${3}" fi - eval "${1}"="$(sed -n "s/^.*${2}\s\+\"\(.*\)\"/\1/p;q" "${servercfgfullpath}")" + eval "${1}"="$(sed -n '/^[[:space:]]*set hostname[[:space:]]*\"\?\(.*\)\?\"/ { s//\1/p;q }' "${servercfgfullpath}")" } # Config Type: json @@ -67,7 +67,7 @@ fn_info_game_sqf() { # [^/]* This matches any character except a forward slash (/) zero or more times. # ${2} matches the literal string "${2}". # = " This matches the literal string " = ". - # \(.*\)": This is a capturing group that matches any sequence of characters until a closing double quote. It captures the desired value for later use. + # \(.*\)" This is a capturing group that matches any sequence of characters until a closing double quote. It captures the desired value for later use. # s//\1/ This performs a substitution with an empty search pattern (//) and replaces it with the captured value inside the capturing group (\1). # p at the end of the s command tells sed to print the resulting line if there was a match. # q at the end of the s command tells sed to quit after the first match. @@ -107,6 +107,17 @@ fn_info_game_valve_keyvalues() { fi } +fn_info_game_java_properties() { + # sed is used to process the file. + # -n option tells sed to suppress output by default. + # s/ indicates that the command is a substitution command. + + if [ -f "${servercfgfullpath}" ]; then + eval "${1}"="$(sed -n 's/.*= *//^${2}\(.*\)/\1/p' "${servercfgfullpath}")" + fi + +} + # Config Type: ini # Parameters: false # Comment: ; or # @@ -1188,6 +1199,9 @@ fn_info_game_lo() { # Example: motd=SERVERNAME # Filetype: properties fn_info_game_mc() { + if [ -f "${servercfgfullpath}" ]; then + + fi # Config if [ ! -f "${servercfgfullpath}" ]; then servername="${unavailable}" diff --git a/package-lock.json b/package-lock.json index b592f5bea..8532248e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "name": "linuxgsm", "license": "MIT", "devDependencies": { - "prettier": "^2.7.1", + "prettier": "^2.8.8", "prettier-plugin-sh": "^0.12.8" } }, @@ -127,9 +127,9 @@ "dev": true }, "node_modules/open": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/open/-/open-8.4.1.tgz", - "integrity": "sha512-/4b7qZNhv6Uhd7jjnREh1NjnPxlTq+XNWPG88Ydkj5AILcA5m3ajvcg57pB24EQjKv0dK62XnDqk9c/hkIG5Kg==", + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz", + "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==", "dev": true, "dependencies": { "define-lazy-prop": "^2.0.0", @@ -159,9 +159,9 @@ "dev": true }, "node_modules/prettier": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", - "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true, "bin": { "prettier": "bin-prettier.js" diff --git a/package.json b/package.json index c62ce3175..f3d3df0fd 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "test": "tests" }, "devDependencies": { - "prettier": "^2.7.1", + "prettier": "^2.8.8", "prettier-plugin-sh": "^0.12.8" }, "scripts": {