@Override public void initGui() { buttonList.clear(); buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 72 + 12, "Update")); buttonList.add(new GuiButton(1, width / 2 - 100, height / 4 + 96 + 12, "Cancel")); ((GuiButton) buttonList.get(0)).enabled = !MekanismUtils.noUpdates() && !ThreadClientUpdate.hasUpdated; }
@Override protected void actionPerformed(GuiButton guibutton) { if (!guibutton.enabled) { return; } if (guibutton.id == 0) { if (!MekanismUtils.noUpdates()) { updatedRecently = true; updateProgress = "Downloading latest version..."; guibutton.enabled = false; if (Mekanism.versionNumber.comparedState(Version.get(Mekanism.latestVersionNumber)) == -1) { new ThreadClientUpdate( "http://dl.dropbox.com/u/90411166/Mekanism-v" + Mekanism.latestVersionNumber + ".jar", ""); } for (IModule module : Mekanism.modulesLoaded) { if (module.getVersion().comparedState(Version.get(Mekanism.latestVersionNumber)) == -1) { new ThreadClientUpdate( "http://dl.dropbox.com/u/90411166/Mekanism" + module.getName() + "-v" + Mekanism.latestVersionNumber + ".jar", module.getName()); } } } else { updateProgress = "You already have the latest version."; } } if (guibutton.id == 1) { mc.displayGuiScreen(null); } }