mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Made Update Checker not break when using an unstable build
This commit is contained in:
parent
116dc6d174
commit
01853ae9af
3 changed files with 16 additions and 3 deletions
|
@ -107,7 +107,7 @@ public final class BookletUtils{
|
||||||
version = "Dev's Edition";
|
version = "Dev's Edition";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
version = StringUtil.localize("info."+ModUtil.MOD_ID+".booklet.edition")+" "+ModUtil.VERSION.substring(ModUtil.VERSION.indexOf("r")+1);
|
version = StringUtil.localize("info."+ModUtil.MOD_ID+".booklet.edition")+" "+Util.getMajorModVersion();
|
||||||
}
|
}
|
||||||
strg = TextFormatting.GOLD+TextFormatting.ITALIC.toString()+"-"+version+"-";
|
strg = TextFormatting.GOLD+TextFormatting.ITALIC.toString()+"-"+version+"-";
|
||||||
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+33, 0);
|
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+33, 0);
|
||||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.update;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
|
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
@ -33,7 +34,7 @@ public class ThreadUpdateChecker extends Thread{
|
||||||
Properties updateProperties = new Properties();
|
Properties updateProperties = new Properties();
|
||||||
updateProperties.load(new InputStreamReader(newestURL.openStream()));
|
updateProperties.load(new InputStreamReader(newestURL.openStream()));
|
||||||
|
|
||||||
String currentMcVersion = ModUtil.VERSION.split("-")[0];
|
String currentMcVersion = Util.getMcVersion();
|
||||||
if(ConfigBoolValues.UPDATE_CHECK_VERSION_SPECIFIC.isEnabled()){
|
if(ConfigBoolValues.UPDATE_CHECK_VERSION_SPECIFIC.isEnabled()){
|
||||||
String newestVersionProp = updateProperties.getProperty(currentMcVersion);
|
String newestVersionProp = updateProperties.getProperty(currentMcVersion);
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ public class ThreadUpdateChecker extends Thread{
|
||||||
UpdateChecker.updateVersionString = highestString;
|
UpdateChecker.updateVersionString = highestString;
|
||||||
}
|
}
|
||||||
|
|
||||||
String clientVersionString = ModUtil.VERSION.substring(ModUtil.VERSION.indexOf("r")+1);
|
String clientVersionString = Util.getMajorModVersion();
|
||||||
int clientVersion = Integer.parseInt(clientVersionString.contains("_") ? clientVersionString.substring(0, clientVersionString.indexOf("_")) : clientVersionString);
|
int clientVersion = Integer.parseInt(clientVersionString.contains("_") ? clientVersionString.substring(0, clientVersionString.indexOf("_")) : clientVersionString);
|
||||||
if(UpdateChecker.updateVersionInt > clientVersion){
|
if(UpdateChecker.updateVersionInt > clientVersion){
|
||||||
UpdateChecker.needsUpdateNotify = true;
|
UpdateChecker.needsUpdateNotify = true;
|
||||||
|
|
|
@ -41,4 +41,16 @@ public final class Util{
|
||||||
public static boolean isDevVersion(){
|
public static boolean isDevVersion(){
|
||||||
return ModUtil.VERSION.equals("@VERSION@");
|
return ModUtil.VERSION.equals("@VERSION@");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String[] splitVersion(){
|
||||||
|
return ModUtil.VERSION.split("-");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMcVersion(){
|
||||||
|
return splitVersion()[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMajorModVersion(){
|
||||||
|
return splitVersion()[1].substring(1);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue