import minecraftProtocol from "@wp2508/minecraft-protocol"; import type {Socket} from "socket.io-client"; import {console_print} from "../../../utils/console_print.ts"; export async function update_version_list(socket: Socket, node_id: number) { const version_list = minecraftProtocol.supportedVersions; try { const response = await socket .timeout(5000) .emitWithAck('update_version_list', { id: node_id, version_list, }); if (!response || (response.status !== 'success' && response.status !== 'error')) { throw new Error('响应格式无效'); } if (response.status === 'error') { throw new Error(`收到错误码: ${response.data}`); } console_print.log(console_print.success("支持的版本列表更新成功")) } catch (error) { throw new Error(`版本列表上报失败: ${error instanceof Error ? error.message : String(error)}`); } }