Add human readable minecraft version

This commit is contained in:
sqozz 2021-05-10 18:18:20 +02:00
parent b5a570c4ec
commit eb15218f47
2 changed files with 4 additions and 1 deletions

View file

@ -5,6 +5,7 @@ from bottle import route, run, static_file, template
from random import random, choice from random import random, choice
from mcrcon import MCRcon from mcrcon import MCRcon
from os import listdir, sysconf from os import listdir, sysconf
import minecraft_data
import configparser import configparser
import platform import platform
import requests import requests
@ -120,7 +121,8 @@ def get_cpuinfo():
def paper_version(): def paper_version():
status = server_status() status = server_status()
paper_version = status.version.name paper_version = status.version.name
mc_version = status.version.protocol 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")
return {"paper": paper_version, "minecraft": mc_version} return {"paper": paper_version, "minecraft": mc_version}
def datapack_info(): def datapack_info():

View file

@ -2,3 +2,4 @@ bottle==0.12.19
mcrcon==0.6.0 mcrcon==0.6.0
mcstatus==5.2.0 mcstatus==5.2.0
requests==2.25.1 requests==2.25.1
minecraft-data==2.84.0