diff options
| author | Ninjune <enderknight537@gmail.com> | 2022-11-08 13:50:45 -0600 |
|---|---|---|
| committer | Ninjune <enderknight537@gmail.com> | 2022-11-08 13:50:45 -0600 |
| commit | 342987d0c06afe8935d9c0dfe28f71c3784c84cd (patch) | |
| tree | 281005387cbe1cfa64599c4b380d71c083d3d37c | |
| parent | e72c42345ef32fe9f3eeaf92844c0b77f175fac6 (diff) | |
| download | coleweight-1.6.0.tar.gz coleweight-1.6.0.tar.bz2 coleweight-1.6.0.zip | |
Fixed(?) Updaterv1.6.0
| -rw-r--r-- | metadata.json | 2 | ||||
| -rw-r--r-- | util/updater.js | 24 |
2 files changed, 23 insertions, 3 deletions
diff --git a/metadata.json b/metadata.json index 6974f2e..0136588 100644 --- a/metadata.json +++ b/metadata.json @@ -3,6 +3,6 @@ "creator": "Ninjune", "entry": "index.js", "description": "Simple Coleweight module to measure mining progression.", - "version": "1.5.4", + "version": "1.5.5", "requires": ["axios", "PogData", "Vigilance"] }
\ No newline at end of file diff --git a/util/updater.js b/util/updater.js index 64fbe1b..f80bc9c 100644 --- a/util/updater.js +++ b/util/updater.js @@ -6,8 +6,19 @@ VERSION = constants.VERSION register("worldLoad", () => { axios.get(`https://chattriggers.com/api/modules/1367`) .then(res => { - if(res.data.releases[0].releaseVersion != VERSION && constants.beta == false) + let ctVersionArray = (res.data.releases[0].releaseVersion).split('.'), + currentVersionArray = VERSION.split('.'), + newVersion = false + + for(let i = 0; i < ctVersionArray.length; i++) + { + if (ctVersionArray[i] > currentVersionArray[i]) + newVersion = true + } + + if(newVersion) { + ChatLib.chat(VERSION + " " + res.data.releases[0].releaseVersion) ChatLib.chat(`${PREFIX}&eYou are using an unsupported version of Coleweight!`) new TextComponent(`${PREFIX}&eClick &3here&e to update!`) .setClickAction("run_command") @@ -19,7 +30,16 @@ register("worldLoad", () => { { axios.get(`https://raw.githubusercontent.com/Ninjune/coleweight/main/metadata.json`) .then(res => { - if(res.data.version == VERSION || constants.beta == true) return + let githubVersionArray = (res.data.version).split('.') + + for(let i = 0; i < githubVersionArray.length; i++) + { + if(githubVersionArray[i] > currentVersionArray[i]) + newVersion = true + } + + if(!newVersion) 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") |
