diff options
author | Ninjune x <enderknight537@gmail.com> | 2022-11-17 16:56:06 -0600 |
---|---|---|
committer | Ninjune x <enderknight537@gmail.com> | 2022-11-17 16:56:06 -0600 |
commit | fb63481d2c5b7b468df6c5ebdee30178bc9155f5 (patch) | |
tree | 3ec467f8acb9594c7b5547426a3b640856dc7e37 /util/updater.js | |
parent | 9085ac77ce364572b14f132b64ead5cde2194607 (diff) | |
download | coleweight-fb63481d2c5b7b468df6c5ebdee30178bc9155f5.tar.gz coleweight-fb63481d2c5b7b468df6c5ebdee30178bc9155f5.tar.bz2 coleweight-fb63481d2c5b7b468df6c5ebdee30178bc9155f5.zip |
1.6.0 Changelog in releasesv1.6.1
Diffstat (limited to 'util/updater.js')
-rw-r--r-- | util/updater.js | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/util/updater.js b/util/updater.js index 43693e3..ea8fa2c 100644 --- a/util/updater.js +++ b/util/updater.js @@ -1,12 +1,25 @@ import axios from "../../axios" import constants from "./constants" -PREFIX = constants.PREFIX -VERSION = constants.VERSION + +const PREFIX = constants.PREFIX, + VERSION = constants.VERSION register("worldLoad", () => { axios.get(`https://chattriggers.com/api/modules/1367`) .then(res => { - if(res.data.releases[0].releaseVersion != VERSION) + let ctVersionArray = (res.data.releases[0].releaseVersion).split('.'), + currentVersionArray = VERSION.split('.'), + newVersion = false + + for(let i = ctVersionArray.length; i >= 0; i--) + { + if (ctVersionArray[i] > currentVersionArray[i]) + newVersion = true + else if (currentVersionArray[i] > ctVersionArray[i]) + newVersion = false + } + + if(newVersion) { ChatLib.chat(`${PREFIX}&eYou are using an unsupported version of Coleweight!`) new TextComponent(`${PREFIX}&eClick &3here&e to update!`) @@ -15,23 +28,6 @@ register("worldLoad", () => { .chat() ChatLib.chat("") } - else - { - axios.get(`https://raw.githubusercontent.com/Ninjune/coleweight/main/metadata.json`) - .then(res => { - if(res.data.version == VERSION) return - ChatLib.chat(`${PREFIX}&eYou are using an unsupported version of Coleweight!`) - new TextComponent(`${PREFIX}&eClick &3here&e to open the github releases!`) - .setClickAction("open_url") - .setClickValue(`https://github.com/Ninjune/coleweight/releases`) - .chat() - ChatLib.chat("") - return - }) - .catch(err => { - ChatLib.chat(err) - }) - } }) }) |