blob: f80bc9c8fb9bbd0db456232a5ff571c917ada45d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
import axios from "../../axios"
import constants from "./constants"
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 = 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")
.setClickValue(`/ct load`)
.chat()
ChatLib.chat("")
}
else
{
axios.get(`https://raw.githubusercontent.com/Ninjune/coleweight/main/metadata.json`)
.then(res => {
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")
.setClickValue(`https://github.com/Ninjune/coleweight/releases`)
.chat()
ChatLib.chat("")
return
})
.catch(err => {
ChatLib.chat(err)
})
}
})
})
export default ""
|