diff options
author | Ninjune <enderknight537@gmail.com> | 2022-12-02 17:42:08 -0600 |
---|---|---|
committer | Ninjune <enderknight537@gmail.com> | 2022-12-02 17:42:08 -0600 |
commit | 1d26a47068b357c4a9f4cb0225aa063134e9a0d9 (patch) | |
tree | f5d62828a9330c47f4e3675197625c464f8a9400 /chat/updater.js | |
parent | 86417e52fa78ea4096a155c2e70183d34aeaf530 (diff) | |
download | coleweight-1.6.11.tar.gz coleweight-1.6.11.tar.bz2 coleweight-1.6.11.zip |
v1.6.10v1.6.11
Diffstat (limited to 'chat/updater.js')
-rw-r--r-- | chat/updater.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/chat/updater.js b/chat/updater.js new file mode 100644 index 0000000..c936e80 --- /dev/null +++ b/chat/updater.js @@ -0,0 +1,35 @@ +import axios from "../../axios" +import constants from "../util/constants" + +const PREFIX = constants.PREFIX, + VERSION = constants.VERSION + +register("worldLoad", () => { + axios.get(`https://chattriggers.com/api/modules/1367`) + .then(res => { + 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!`) + .setClickAction("run_command") + .setClickValue(`/ct load`) + .chat() + ChatLib.chat("") + } + }) + +}) + +export default ""
\ No newline at end of file |