Browse Source

Fix version rendering if minecraft version is not found in minecraft-data

master
sqozz 6 months ago
parent
commit
4679909010
  1. 6
      homepage/main.py

6
homepage/main.py

@ -123,7 +123,11 @@ def paper_version(): @@ -123,7 +123,11 @@ def paper_version():
status = server_status()
paper_version = status.version.name
protocol_version = status.version.protocol
mc_version = list(filter(lambda x: x.get("version", 0) == protocol_version, minecraft_data.common().protocolVersions))[0].get("minecraftVersion", "Unknown")
possible_versions = list(filter(lambda x: x.get("version", 0) == protocol_version, minecraft_data.common().protocolVersions))
try:
mc_version = possible_versions[0].get("minecraftVersion", "Unknown")
except:
mc_version = "Unknown"
return {"paper": paper_version, "minecraft": mc_version}
def datapack_info():

Loading…
Cancel
Save