diff --git a/config-anticheat.py b/config-anticheat.py index 9ab5bba..727aae9 100644 --- a/config-anticheat.py +++ b/config-anticheat.py @@ -1,3 +1,4 @@ +import io from utils import * import zipfile, base64, shutil @@ -7,9 +8,8 @@ def extract_zipfile(): - with open("temp.zip", "wb") as w: - w.write(base64.b64decode(config)) - zip = zipfile.ZipFile("temp.zip") + config_file = io.BytesIO(base64.b64decode(config)) + zip = zipfile.ZipFile(config_file) zip.extractall(os.path.join(os.getcwd(), "temp")) diff --git a/install-java.py b/install-java.py new file mode 100644 index 0000000..5860e4c --- /dev/null +++ b/install-java.py @@ -0,0 +1,24 @@ +from utils import * +install_package("install-jdk") +import jdk +import os + +script_license() + +def java_install(): + try: + jdk.install("8") if ask("服务器版本是否小于等于 1.16.5? ") else jdk.install("19") + except Exception as e: + print(f"安装失败: {e}") + exit_() + + path = os.path.expanduser("~") + "\\.jdk" + java_path = os.path.join(path, os.listdir(path)[0]) + + # os.system(f"setx JAVA_HOME {java_path}") + # os.system(f'setx "Path" "%Path%;%JAVA_HOME%\\bin" /m') + print("安装完成") + +if __name__ == "__main__": + java_install() + exit_() \ No newline at end of file