diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-11-06 18:15:47 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-11-06 18:15:47 +0800 |
commit | b33a75b2eba88c60280fcd441a5dd974cf763ab4 (patch) | |
tree | 53bd51697f69596fdcc388cdc71cc91b745f8f67 /features/changeLogGUI/index.js | |
parent | bae481562a9186cafebdde2be9ac53b93cb98885 (diff) | |
download | SoopyV2-b33a75b2eba88c60280fcd441a5dd974cf763ab4.tar.gz SoopyV2-b33a75b2eba88c60280fcd441a5dd974cf763ab4.tar.bz2 SoopyV2-b33a75b2eba88c60280fcd441a5dd974cf763ab4.zip |
Added update notif, cosmetics, and unfinished museum overlay
Diffstat (limited to 'features/changeLogGUI/index.js')
-rw-r--r-- | features/changeLogGUI/index.js | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/features/changeLogGUI/index.js b/features/changeLogGUI/index.js index f6595b0..daecf96 100644 --- a/features/changeLogGUI/index.js +++ b/features/changeLogGUI/index.js @@ -24,6 +24,34 @@ class ChangeLogGui extends Feature { this.initVariables() this.ChangelogPage = new ChangelogPage() + + this.latestAnnouncedVersion = this.ChangelogPage.currVersionId + + this.registerEvent("worldLoad", this.worldLoad) + } + + worldLoad(){ + if(!this.FeatureManager.features["globalSettings"]) return + if(!this.FeatureManager.features["globalSettings"].class.notifyNewVersion.getValue()) return + if(this.ChangelogPage.downloadableVersion === -1) return + if(this.latestAnnouncedVersion < this.ChangelogPage.downloadableVersion){ + let version = "" + this.ChangelogPage.changelogData.forEach(data=>{ + + if(this.ChangelogPage.downloadableVersion === data.versionId && this.ChangelogPage.downloadableVersion > this.ChangelogPage.currVersionId){ + //add button to download this version + version = data.version + } + }) + + ChatLib.chat("&1" + ChatLib.getChatBreak("-").substr(1)) + ChatLib.chat(" &6New Soopyaddons Version is avalible (" + version + ")") + ChatLib.chat("") + new TextComponent(" &e[CLICK] &7- View changelog and download update").setHover("show_text", "&2Open changelog").setClick("run_command", "/soopyv2 changelog").chat() + ChatLib.chat("&1" + ChatLib.getChatBreak("-").substr(1)) + + this.latestAnnouncedVersion = this.ChangelogPage.downloadableVersion + } } initVariables(){ @@ -45,7 +73,7 @@ class ChangelogPage extends GuiPage { this.pages = [this.newPage()] this.changelogData = [] - this.downloadableVersion = 0 + this.downloadableVersion = -1 let changelogTitle = new SoopyTextElement().setText("ยง0Changelog").setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1) this.pages[0].addChild(changelogTitle) @@ -92,15 +120,21 @@ This is fine if you trust me to not put a virus in it, but if you dont you shoul this.currVersionId = metadata.versionId this.finaliseLoading() + + this.loadChangeLog() } - onOpen(){ - new Thread(()=>{ - let data = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/soopyv2/changelog.json")) + loadChangeLog(){ + let data = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/soopyv2/changelog.json")) + + this.changelogData = data.changelog.reverse() - this.changelogData = data.changelog.reverse() + this.downloadableVersion = data.downloadableVersion + } - this.downloadableVersion = data.downloadableVersion + onOpen(){ + new Thread(()=>{ + this.loadChangeLog() this.updateText() }).start() @@ -140,7 +174,7 @@ This is fine if you trust me to not put a virus in it, but if you dont you shoul this.progressBar.setProgress(0.75) FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/SoopyV2")) - + this.progressBar.setProgress(0.9) new File("./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons/SoopyV2").renameTo(new File("./config/ChatTriggers/modules/SoopyV2")) |