Fix homepage if mcrcon is not available
This commit is contained in:
parent
b8d9f708ed
commit
947c4f9d30
|
@ -131,8 +131,10 @@ def paper_version():
|
|||
return {"paper": paper_version, "minecraft": mc_version}
|
||||
|
||||
def datapack_info():
|
||||
try:
|
||||
with MCRcon(CONFIG["mcrcon"]["host"], CONFIG["mcrcon"]["password"], port=int(CONFIG["mcrcon"]["port"])) as mcr:
|
||||
resp = mcr.command("datapack list")
|
||||
|
||||
match = re.match("There are [0-9]* data packs enabled: (\[.*\])*.*", resp)
|
||||
datapacks = []
|
||||
datapacks_string = match.group(1)
|
||||
|
@ -144,6 +146,9 @@ def datapack_info():
|
|||
datapack_name = datapack_name.replace(".zip", "")
|
||||
if not datapack_name in ["vanilla", "bukkit"]:
|
||||
datapacks.append(datapack_name)
|
||||
except ConnectionRefusedError:
|
||||
datapacks = []
|
||||
|
||||
return datapacks
|
||||
|
||||
def server_details():
|
||||
|
|
Loading…
Reference in a new issue