Testing some new Version Check mechanics
This commit is contained in:
parent
4cd352c7dc
commit
f0ac7a41fc
6 changed files with 65 additions and 17 deletions
|
@ -46,6 +46,7 @@ public class ConfigurationHandler {
|
||||||
/* General configs */
|
/* General configs */
|
||||||
ConfigurationSettings.DISPLAY_VERSION_RESULT = configuration.get(CATEGORY_GENERAL, ConfigurationSettings.DISPLAY_VERSION_RESULT_CONFIGNAME, ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT).getBoolean(ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT);
|
ConfigurationSettings.DISPLAY_VERSION_RESULT = configuration.get(CATEGORY_GENERAL, ConfigurationSettings.DISPLAY_VERSION_RESULT_CONFIGNAME, ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT).getBoolean(ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT);
|
||||||
ConfigurationSettings.LAST_DISCOVERED_VERSION = configuration.get(CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME, ConfigurationSettings.LAST_DISCOVERED_VERSION_DEFAULT).getString();
|
ConfigurationSettings.LAST_DISCOVERED_VERSION = configuration.get(CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME, ConfigurationSettings.LAST_DISCOVERED_VERSION_DEFAULT).getString();
|
||||||
|
ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE = configuration.get(CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE_CONFIGNAME, ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE_DEFAULT).getString();
|
||||||
|
|
||||||
/* Graphic configs */
|
/* Graphic configs */
|
||||||
ConfigurationSettings.ENABLE_PARTICLE_FX = configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT).getBoolean(ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT);
|
ConfigurationSettings.ENABLE_PARTICLE_FX = configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT).getBoolean(ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT);
|
||||||
|
|
|
@ -14,9 +14,8 @@ import com.pahimar.ee3.lib.Strings;
|
||||||
public class ConfigurationSettings {
|
public class ConfigurationSettings {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* General configuration settings
|
* Version check related settings
|
||||||
*/
|
*/
|
||||||
// Whether or not EE3 will do a version check when loaded
|
|
||||||
public static boolean DISPLAY_VERSION_RESULT;
|
public static boolean DISPLAY_VERSION_RESULT;
|
||||||
public static final String DISPLAY_VERSION_RESULT_CONFIGNAME = "version_check.display_results";
|
public static final String DISPLAY_VERSION_RESULT_CONFIGNAME = "version_check.display_results";
|
||||||
public static final boolean DISPLAY_VERSION_RESULT_DEFAULT = true;
|
public static final boolean DISPLAY_VERSION_RESULT_DEFAULT = true;
|
||||||
|
@ -25,6 +24,10 @@ public class ConfigurationSettings {
|
||||||
public static final String LAST_DISCOVERED_VERSION_CONFIGNAME = "version_check.last_discovered_version";
|
public static final String LAST_DISCOVERED_VERSION_CONFIGNAME = "version_check.last_discovered_version";
|
||||||
public static final String LAST_DISCOVERED_VERSION_DEFAULT = "";
|
public static final String LAST_DISCOVERED_VERSION_DEFAULT = "";
|
||||||
|
|
||||||
|
public static String LAST_DISCOVERED_VERSION_TYPE;
|
||||||
|
public static final String LAST_DISCOVERED_VERSION_TYPE_CONFIGNAME = "version_check.last_discovered_version_type";
|
||||||
|
public static final String LAST_DISCOVERED_VERSION_TYPE_DEFAULT = "";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Audio config settings
|
* Audio config settings
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class VersionHelper implements Runnable {
|
||||||
private static byte result = UNINITIALIZED;
|
private static byte result = UNINITIALIZED;
|
||||||
public static String remoteVersion = null;
|
public static String remoteVersion = null;
|
||||||
public static String remoteUpdateLocation = null;
|
public static String remoteUpdateLocation = null;
|
||||||
|
public static String remoteVersionType = null;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Checks the version of the currently running instance of the mod against
|
* Checks the version of the currently running instance of the mod against
|
||||||
|
@ -65,28 +66,68 @@ public class VersionHelper implements Runnable {
|
||||||
String remoteVersionProperty = remoteVersionProperties.getProperty(Loader.instance().getMCVersionString());
|
String remoteVersionProperty = remoteVersionProperties.getProperty(Loader.instance().getMCVersionString());
|
||||||
|
|
||||||
if (remoteVersionProperty != null) {
|
if (remoteVersionProperty != null) {
|
||||||
remoteVersion = remoteVersionProperty.substring(0, remoteVersionProperty.indexOf("|"));
|
String[] remoteVersionTokens = remoteVersionProperty.split("|");
|
||||||
remoteUpdateLocation = remoteVersionProperty.substring(remoteVersionProperty.indexOf("|") + 1);
|
|
||||||
|
if (remoteVersionTokens.length == 2) {
|
||||||
|
remoteVersion = remoteVersionTokens[0];
|
||||||
|
remoteUpdateLocation = remoteVersionTokens[1];
|
||||||
|
}
|
||||||
|
else if (remoteVersionTokens.length == 3) {
|
||||||
|
remoteVersion = remoteVersionTokens[0];
|
||||||
|
remoteUpdateLocation = remoteVersionTokens[1];
|
||||||
|
remoteVersionType = remoteVersionTokens[2];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = ERROR;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remoteVersion != null) {
|
if (remoteVersion != null) {
|
||||||
if (!ConfigurationSettings.LAST_DISCOVERED_VERSION.equalsIgnoreCase(remoteVersion)) {
|
if (!ConfigurationSettings.LAST_DISCOVERED_VERSION.equalsIgnoreCase(remoteVersion)) {
|
||||||
ConfigurationHandler.set(Configuration.CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME, remoteVersion);
|
ConfigurationHandler.set(Configuration.CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME, remoteVersion);
|
||||||
|
|
||||||
|
if (remoteVersionType != null) {
|
||||||
|
ConfigurationHandler.set(Configuration.CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE_CONFIGNAME, remoteVersionType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remoteVersion.equals(Reference.VERSION)) {
|
if (remoteVersion.equalsIgnoreCase(Reference.VERSION)) {
|
||||||
|
if (remoteVersionType != null) {
|
||||||
|
if (remoteVersionType.equalsIgnoreCase(Reference.VERSION_TYPE) && remoteVersionType.equalsIgnoreCase(Strings.RECOMMENDED_VERSION)) {
|
||||||
result = CURRENT;
|
result = CURRENT;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
if (remoteVersionProperty == null) {
|
result = CURRENT;
|
||||||
result = MC_VERSION_NOT_FOUND;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = OUTDATED;
|
result = OUTDATED;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
result = ERROR;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = MC_VERSION_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* if (remoteVersion != null) { if
|
||||||
|
* (!ConfigurationSettings.LAST_DISCOVERED_VERSION
|
||||||
|
* .equalsIgnoreCase(remoteVersion)) {
|
||||||
|
* ConfigurationHandler.set(Configuration.CATEGORY_GENERAL,
|
||||||
|
* ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME,
|
||||||
|
* remoteVersion); } if (remoteVersion.equals(Reference.VERSION)) {
|
||||||
|
* result = CURRENT; return; } } if (remoteVersionProperty == null)
|
||||||
|
* { result = MC_VERSION_NOT_FOUND; } else { result = OUTDATED; }
|
||||||
|
*/
|
||||||
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
|
@ -18,6 +18,7 @@ public class Reference {
|
||||||
public static final String MOD_ID = "EE3";
|
public static final String MOD_ID = "EE3";
|
||||||
public static final String MOD_NAME = "Equivalent Exchange 3";
|
public static final String MOD_NAME = "Equivalent Exchange 3";
|
||||||
public static final String VERSION = "@VERSION@";
|
public static final String VERSION = "@VERSION@";
|
||||||
|
public static final String VERSION_TYPE = "@VERSION_TYPE@";
|
||||||
public static final String CHANNEL_NAME = MOD_ID;
|
public static final String CHANNEL_NAME = MOD_ID;
|
||||||
public static final int SECOND_IN_TICKS = 20;
|
public static final int SECOND_IN_TICKS = 20;
|
||||||
public static final int SHIFTED_ID_RANGE_CORRECTION = 256;
|
public static final int SHIFTED_ID_RANGE_CORRECTION = 256;
|
||||||
|
|
|
@ -23,6 +23,8 @@ public class Strings {
|
||||||
public static final String GENERAL_ERROR_MESSAGE = "version.general_error";
|
public static final String GENERAL_ERROR_MESSAGE = "version.general_error";
|
||||||
public static final String FINAL_ERROR_MESSAGE = "version.final_error";
|
public static final String FINAL_ERROR_MESSAGE = "version.final_error";
|
||||||
public static final String MC_VERSION_NOT_FOUND = "version.mc_version_not_found";
|
public static final String MC_VERSION_NOT_FOUND = "version.mc_version_not_found";
|
||||||
|
public static final String DEVELOPMENT_VERSION = "Development";
|
||||||
|
public static final String RECOMMENDED_VERSION = "Recommended";
|
||||||
|
|
||||||
/* NBT related constants */
|
/* NBT related constants */
|
||||||
public static final String NBT_ITEM_CHARGE_LEVEL_KEY = "itemChargeLevel";
|
public static final String NBT_ITEM_CHARGE_LEVEL_KEY = "itemChargeLevel";
|
||||||
|
|
|
@ -14,13 +14,13 @@
|
||||||
<entry key="item.dustAlchemicalMinium.name">Mönjäinen pöly</entry>
|
<entry key="item.dustAlchemicalMinium.name">Mönjäinen pöly</entry>
|
||||||
<entry key="item.dustAlchemicalVerdant.name">Vehreä pöly</entry>
|
<entry key="item.dustAlchemicalVerdant.name">Vehreä pöly</entry>
|
||||||
<entry key="item.dustAlchemicalAzure.name">Taivaansininen pöly</entry>
|
<entry key="item.dustAlchemicalAzure.name">Taivaansininen pöly</entry>
|
||||||
<entry key="item.dustAlchemicalAmaranthine.name">Ikikukkaispöly</entry><
|
<entry key="item.dustAlchemicalAmaranthine.name">Ikikukkaispöly</entry>
|
||||||
<entry key="item.dustAlchemicalIridescent.name">Sateenkaarenkirjava pöly</entry>
|
<entry key="item.dustAlchemicalIridescent.name">Sateenkaarenkirjava pöly</entry>
|
||||||
<entry key="item.alchemicalBag.name">Alkeminen pussi</entry>
|
<entry key="item.alchemicalBag.name">Alkeminen pussi</entry>
|
||||||
<entry key="tile.redWaterStill.name">Punavesi (Liikkumaton)</entry>
|
<entry key="tile.redWaterStill.name">Punavesi (Liikkumaton)</entry>
|
||||||
<entry key="tile.redWaterFlowing.name">Punavesi (Virtaava)</entry>
|
<entry key="tile.redWaterFlowing.name">Punavesi (Virtaava)</entry>
|
||||||
<entry key="tile.calcinator.name">Kalsinaattori</entry>
|
<entry key="tile.calcinator.name">Kalsinaattori</entry>
|
||||||
<entry key="tile.aludel.name">Aludeli</entry> <comment>This needs better translation!</comment>
|
<entry key="tile.aludel.name">Aludeli</entry>
|
||||||
<entry key="tile.alchemicalChest.name">Alchemical Chest</entry>
|
<entry key="tile.alchemicalChest.name">Alchemical Chest</entry>
|
||||||
<entry key="container.calcinator">Calcinator</entry>
|
<entry key="container.calcinator">Calcinator</entry>
|
||||||
<entry key="container.aludel">Aludel</entry>
|
<entry key="container.aludel">Aludel</entry>
|
||||||
|
|
Loading…
Reference in a new issue