Updated Update Checker

This commit is contained in:
Ellpeck 2015-10-13 02:12:30 +02:00
parent 1dbe79ac6f
commit c5f11fb380
2 changed files with 22 additions and 24 deletions

View file

@ -153,12 +153,18 @@ public class GuiBooklet extends GuiScreen{
}
//Update Checker Hover Text
if(x >= this.guiLeft-11 && x <= this.guiLeft-11+10 && y >= this.guiTop-11 && y <= this.guiTop-11+10){
if(UpdateChecker.doneChecking && UpdateChecker.updateVersion > UpdateChecker.clientVersion){
if(UpdateChecker.doneChecking){
ArrayList list = new ArrayList();
if(UpdateChecker.checkFailed){
list.add(EnumChatFormatting.DARK_RED+"The Update Check failed!");
list.add("Check your log for more Information!");
}
else if(UpdateChecker.updateVersion > UpdateChecker.clientVersion){
list.add(EnumChatFormatting.GOLD+"There is an Update available!");
list.add(EnumChatFormatting.ITALIC+"You have: "+ModUtil.VERSION+", Newest: "+UpdateChecker.updateVersionS);
list.addAll(this.fontRendererObj.listFormattedStringToWidth(EnumChatFormatting.ITALIC+"Updates include: "+UpdateChecker.changelog, TOOLTIP_SPLIT_LENGTH));
list.add(EnumChatFormatting.GRAY+"Click this button to visit the download page!");
}
this.func_146283_a(list, x, y);
}
}

View file

@ -39,19 +39,12 @@ public class ThreadUpdateChecker extends Thread{
changeReader.close();
ModUtil.LOGGER.info("Update Check done!");
}
catch(Exception e){
ModUtil.LOGGER.error("Update Check failed!", e);
UpdateChecker.checkFailed = true;
}
if(!UpdateChecker.checkFailed){
try{
UpdateChecker.updateVersion = Integer.parseInt(UpdateChecker.updateVersionS.replace("-", "").replace(".", ""));
UpdateChecker.clientVersion = Integer.parseInt(ModUtil.VERSION.replace("-", "").replace(".", ""));
}
catch(Exception e){
ModUtil.LOGGER.error("Comparing the newest and the current Version failed!", e);
ModUtil.LOGGER.error("Update Check failed!", e);
UpdateChecker.checkFailed = true;
}
@ -67,7 +60,6 @@ public class ThreadUpdateChecker extends Thread{
ModUtil.LOGGER.info("That's cool. You're really up to date, you have all of the latest awesome Features!");
}
}
}
UpdateChecker.doneChecking = true;
}