diff options
author | Gordian Edenhofer | 2019-03-28 11:37:08 +0100 |
---|---|---|
committer | Gordian Edenhofer | 2019-03-28 11:51:00 +0100 |
commit | 057dca49e3c96043a16c8580dbfa1e9fbe3aab1a (patch) | |
tree | e8667b1e5e880d7bbd758f172c556e218577cb1c | |
parent | 961a49728a28d3184519d9cacc816fc7151a56de (diff) | |
download | aur-057dca49e3c96043a16c8580dbfa1e9fbe3aab1a.tar.gz |
upgpkg: minecraft-server 1.13.2-3
Adapt the `is_player_online` function to be a little more generic. This
fixes detecting players on cuberite even with the most recent version.
upgpkg: cuberite 1.12b1014-1
upgpkg: spigot 1.13.2+b93-1
-rw-r--r-- | .SRCINFO | 2 | ||||
-rwxr-xr-x | PKGBUILD | 2 | ||||
-rwxr-xr-x | spigot.sh | 6 |
3 files changed, 6 insertions, 4 deletions
@@ -35,6 +35,6 @@ pkgbase = spigot sha512sums = 76c77e47c442b477216e968db2213612579b24add54cf0e0512f808498673500b4d24e59bce70b1e7479d724a9a897ceb154e937b88a476beb11c8776258b36c sha512sums = 5a32439ff4b8fa9db89e9242206cf99109e0b00f29f87711c25342dda522171d999f7e18fb2013437ddf62cfec05b6677601933233aaf42bcb5d67eb7a1469ee sha512sums = 33f456fd945bb2cfa6b390ce0ab02753cc6366e39abff80a4f2b7aa3aebe3cd31d148b785cbc2aa159dd8ad9fb03233a09f8693eb031b6b9db8dc03643d2397b - sha512sums = 5454383f0bf059129b862d4eec44a25912e37f24d3446158e9c7d7efdb267ee962bc0c20a4f0b2706d35d0421335b95a9b22a9a1f943fb6a72dbac34cbf3dd5f + sha512sums = 58c48e7f06bc4508ca4ef2f661efcec3ab7aea56fd6cc46e1a9a33a99ea978e39912105b74fd359160b25a65195cd4812d8055501d97fc8a8f80ce388ee21a98 pkgname = spigot @@ -29,7 +29,7 @@ sha512sums=('f559fa53c0465d30a0165b643e01a7ddb576282c42d18b899bf844651c4fa144a5e '76c77e47c442b477216e968db2213612579b24add54cf0e0512f808498673500b4d24e59bce70b1e7479d724a9a897ceb154e937b88a476beb11c8776258b36c' '5a32439ff4b8fa9db89e9242206cf99109e0b00f29f87711c25342dda522171d999f7e18fb2013437ddf62cfec05b6677601933233aaf42bcb5d67eb7a1469ee' '33f456fd945bb2cfa6b390ce0ab02753cc6366e39abff80a4f2b7aa3aebe3cd31d148b785cbc2aa159dd8ad9fb03233a09f8693eb031b6b9db8dc03643d2397b' - '5454383f0bf059129b862d4eec44a25912e37f24d3446158e9c7d7efdb267ee962bc0c20a4f0b2706d35d0421335b95a9b22a9a1f943fb6a72dbac34cbf3dd5f') + '58c48e7f06bc4508ca4ef2f661efcec3ab7aea56fd6cc46e1a9a33a99ea978e39912105b74fd359160b25a65195cd4812d8055501d97fc8a8f80ce388ee21a98') _game="spigot" _server_root="/srv/craftbukkit" diff --git a/spigot.sh b/spigot.sh index ffb9a9bbeec0..7cb351d97b25 100755 --- a/spigot.sh +++ b/spigot.sh @@ -82,14 +82,16 @@ game_command() { # Check whether there are player on the server through list is_player_online() { response="$(sleep_time=0.6 return_stdout=true game_command list)" + # Delete leading line and free response string from fancy characters + response="$(echo "${response}" | sed -r -e '$!d' -e 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?[JKmsuG]//g')" # The list command prints a line containing the usernames after the last occurrence of ": " # and since playernames may not contain this string the clean player-list can easily be retrieved. # Otherwiese check the first digit after the last occurrence of "There are". If it is 0 then there # are no players on the server. Should this test fail as well. Assume that a player is online. - if [[ $(echo "${response}" | grep ":" | sed -r -e '$!d' -e 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?[JKmsuG]//g' -e 's/.*\: //' | tr -d '\n' | wc -c) -le 1 ]]; then + if [[ $(echo "${response}" | grep ":" | sed -e 's/.*\: //' | tr -d '\n' | wc -c) -le 1 ]]; then # No player is online return 0 - elif [[ $(echo "${response}" | grep "There are" | sed -r -e '$!d' -e 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?[JKmsuG]//g' -e 's/.*\: //' -e 's/^([^.]+).*$/\1/; s/^[^0-9]*([0-9]+).*$/\1/' | tr -d '\n') -eq 0 ]]; then + elif [[ "x$(echo "${response}" | grep "There are" | sed -r -e 's/.*\: //' -e 's/^([^.]+).*$/\1/; s/^[^0-9]*([0-9]+).*$/\1/' | tr -d '\n')" == "x0" ]]; then # No player is online return 0 else |