Fix parsing if no players are online
This commit is contained in:
parent
f1dbbcbbb1
commit
57b276d7c7
|
@ -59,7 +59,11 @@ def currentPlayerData():
|
|||
with MCRcon(CONFIG["mcrcon"]["host"], CONFIG["mcrcon"]["password"], port=int(CONFIG["mcrcon"]["port"])) as mcr:
|
||||
resp = mcr.command("list uuids")
|
||||
resp = resp.split(":")
|
||||
player_list = resp[1].strip().split(",")
|
||||
player_string = resp[1].strip()
|
||||
if player_string != "":
|
||||
player_list = player_string.split(",")
|
||||
else:
|
||||
player_list = []
|
||||
player_list = list(map(lambda x: x.strip(), player_list))
|
||||
count_regex = re.match("There are ([0-9]+) of a max of ([0-9]+) players online", resp[0])
|
||||
num_players = count_regex.group(1)
|
||||
|
|
Loading…
Reference in a new issue