From 531ee704acaba3336620f740f1c202f1f11ee55d Mon Sep 17 00:00:00 2001 From: Tsubasa6848 <116721335+Tsubasa6848@users.noreply.github.com> Date: Mon, 13 May 2024 20:39:38 +0800 Subject: [PATCH] fix: fix version logic --- lib/GMLIB_API-JS.js | 24 +++++++----------------- manifest.json | 2 +- src/CompatibilityApi.cpp | 2 +- src/Global.h | 2 +- tooth.json | 4 ++-- 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/lib/GMLIB_API-JS.js b/lib/GMLIB_API-JS.js index dd8bdaf..ab9a068 100644 --- a/lib/GMLIB_API-JS.js +++ b/lib/GMLIB_API-JS.js @@ -1,6 +1,3 @@ -// LiteLoader-AIDS automatic generated -/// - const GMLIB_API = { createFloatingText: ll.import("GMLIB_API", "createFloatingText"), deleteFloatingText: ll.import("GMLIB_API", "deleteFloatingText"), @@ -502,28 +499,22 @@ class Version { if (Array.isArray(array) && array.length == 3) { let isNumber = array.every(element => typeof element == "number"); if (isNumber) { - return new Version(array[0], array[1], array[2]) + return new Version(array[0], array[1], array[2]); } } return null; } -} -class GMLIB { - constructor() { - throw new Error("Static class cannot be instantiated"); + static isPluginVersionMatched(version) { + return GMLIB_API.isVersionMatched(version.mMajor, version.mMinor, version.mPatch); } - static isVersionMatched(major, minor, patch) { - return GMLIB_API.isVersionMatched(major, minor, patch); + static getLrcaVersion() { + return Version.fromString(GMLIB_API.getVersion_LRCA()); } - static getVersion_LRCA() { - return GMLIB_API.getVersion_LRCA(); - } - - static getVersion_GMLIB() { - return GMLIB_API.getVersion_GMLIB(); + static getGmlibVersion() { + return Version.fromString(GMLIB_API.getVersion_GMLIB()); } } @@ -879,7 +870,6 @@ module.exports = { Minecraft, Recipes, Experiments, - GMLIB, Scoreboard, JsonConfig, JsonLanguage, diff --git a/manifest.json b/manifest.json index cd86d46..ca6b444 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "${pluginName}", "entry": "${pluginFile}", - "version": "0.12.4", + "version": "0.12.5", "author": "GroupMountain", "type": "native", "dependencies": [ diff --git a/src/CompatibilityApi.cpp b/src/CompatibilityApi.cpp index 6fb677e..14bb233 100644 --- a/src/CompatibilityApi.cpp +++ b/src/CompatibilityApi.cpp @@ -153,7 +153,7 @@ void Export_Compatibility_API() { }); RemoteCall::exportAs("GMLIB_API", "isVersionMatched", [](int a, int b, int c) -> bool { auto version = GMLIB::Version(a, b, c, "", ""); - return version >= LIB_VERSION; + return LIB_VERSION >= version; }); RemoteCall::exportAs("GMLIB_API", "getVersion_LRCA", []() -> std::string { return LIB_VERSION.asString(); }); RemoteCall::exportAs("GMLIB_API", "getVersion_GMLIB", []() -> std::string { diff --git a/src/Global.h b/src/Global.h index 448b261..e143786 100644 --- a/src/Global.h +++ b/src/Global.h @@ -5,7 +5,7 @@ #define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA") -#define LIB_VERSION GMLIB::Version(0, 12, 4) +#define LIB_VERSION GMLIB::Version(0, 12, 5) extern ll::Logger logger; diff --git a/tooth.json b/tooth.json index 2b2e648..49a98d9 100644 --- a/tooth.json +++ b/tooth.json @@ -1,7 +1,7 @@ { "format_version": 2, "tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi", - "version": "0.12.4", + "version": "0.12.5", "info": { "name": "GMLIB-LegacyRemoteCallApi", "description": "Legacy RemoteCall API for GMLIB", @@ -14,7 +14,7 @@ "library" ] }, - "asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.12.4/GMLIB-LegacyRemoteCallApi-windows-x64.zip", + "asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.12.5/GMLIB-LegacyRemoteCallApi-windows-x64.zip", "dependencies": { "github.com/GroupMountain/GMLIB": ">=0.12.4" },