Added version-based handling, bump version to 9.1.1

This commit is contained in:
aidancbrady 2016-08-11 12:15:16 -04:00
parent 245465dc8c
commit ddc9e68f8e
7 changed files with 60 additions and 39 deletions

View file

@ -4,4 +4,4 @@ FMP_version=1.1.2.331
CCLIB_version=1.1.3.136
NEI_version=1.0.4.101
CCC_version=1.0.6.39
mod_version=9.1.0
mod_version=9.1.1

View file

@ -142,7 +142,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
* @author AidanBrady
*
*/
@Mod(modid = "Mekanism", name = "Mekanism", version = "9.1.0", guiFactory = "mekanism.client.gui.ConfigGuiFactory",
@Mod(modid = "Mekanism", name = "Mekanism", version = "9.1.1", guiFactory = "mekanism.client.gui.ConfigGuiFactory",
dependencies = "after:ForgeMultipart;after:BuildCraft;after:BuildCraftAPI;after:IC2;after:CoFHCore;" +
"after:ComputerCraft;after:Galacticraft API;after:MetallurgyCore")
public class Mekanism
@ -168,7 +168,7 @@ public class Mekanism
public static Configuration configuration;
/** Mekanism version number */
public static Version versionNumber = new Version(9, 1, 0);
public static Version versionNumber = new Version(9, 1, 1);
/** MultiblockManagers for various structrures */
public static MultiblockManager<SynchronizedTankData> tankManager = new MultiblockManager<SynchronizedTankData>("dynamicTank");

View file

@ -1,6 +1,9 @@
package mekanism.common;
import java.util.List;
import mekanism.common.util.MekanismUtils;
import cpw.mods.fml.relauncher.FMLInjectionData;
/**
* Thread used to retrieve data from the Mekanism server.
@ -18,8 +21,26 @@ public class ThreadGetData extends Thread
@Override
public void run()
{
Mekanism.latestVersionNumber = MekanismUtils.getLatestVersion();
Mekanism.recentNews = MekanismUtils.getRecentNews();
List<String> ret = MekanismUtils.getHTML("https://dl.dropbox.com/u/90411166/Versions/Mekanism.txt");
Mekanism.latestVersionNumber = "null";
Mekanism.recentNews = "null";
for(String s : ret)
{
String[] text = s.split(":");
if(text.length == 3 && !text[0].contains("UTF-8") && !text[0].contains("HTML") && !text[0].contains("http"))
{
if(Version.get(text[0]) != null && Version.get(text[0]).equals(Version.get((String)FMLInjectionData.data()[4])))
{
Mekanism.latestVersionNumber = text[1];
Mekanism.recentNews = text[2];
break;
}
}
}
MekanismUtils.updateDonators();
}

View file

@ -1,7 +1,7 @@
package mekanism.common;
/**
* Version v1.0.4. Simple version handling for Mekanism.
* Version v2.0.0. Simple version handling for Mekanism.
* @author AidanBrady
*
*/
@ -127,4 +127,29 @@ public class Version
return major + "." + minor + "." + build;
}
}
@Override
public int hashCode()
{
int result = 1;
result = 31 * result + build;
result = 31 * result + major;
result = 31 * result + minor;
return result;
}
@Override
public boolean equals(Object obj)
{
if(obj == null || getClass() != obj.getClass())
{
return false;
}
Version other = (Version)obj;
return build == other.build && major == other.major && minor == other.minor;
}
}

View file

@ -160,28 +160,6 @@ public final class MekanismUtils
return false;
}
/**
* Gets the latest version using getHTML and returns it as a string.
* @return latest version
*/
public static String getLatestVersion()
{
String[] text = merge(getHTML("https://dl.dropbox.com/u/90411166/Mod%20Versions/Mekanism.txt")).split(":");
if(text.length > 1 && !text[0].contains("UTF-8") && !text[0].contains("HTML") && !text[0].contains("http")) return text[0];
return "null";
}
/**
* Gets the recent news using getHTML and returns it as a string.
* @return recent news
*/
public static String getRecentNews()
{
String[] text = merge(getHTML("https://dl.dropbox.com/u/90411166/Mod%20Versions/Mekanism.txt")).split(":");
if(text.length > 1 && !text[1].contains("UTF-8") && !text[1].contains("HTML") && !text[1].contains("http")) return text[1];
return "null";
}
/**
* Updates the donator list by retrieving the most recent information from a foreign document.
*/
@ -202,17 +180,14 @@ public final class MekanismUtils
*/
public static List<String> getHTML(String urlToRead)
{
URL url;
HttpURLConnection conn;
BufferedReader rd;
String line;
List<String> result = new ArrayList<String>();
try {
url = new URL(urlToRead);
conn = (HttpURLConnection)url.openConnection();
URL url = new URL(urlToRead);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("GET");
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while((line = rd.readLine()) != null)
{

View file

@ -44,7 +44,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "9.1.0", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory")
@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "9.1.1", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory")
public class MekanismGenerators implements IModule
{
@SidedProxy(clientSide = "mekanism.generators.client.GeneratorsClientProxy", serverSide = "mekanism.generators.common.GeneratorsCommonProxy")
@ -54,7 +54,7 @@ public class MekanismGenerators implements IModule
public static MekanismGenerators instance;
/** MekanismGenerators version number */
public static Version versionNumber = new Version(9, 1, 0);
public static Version versionNumber = new Version(9, 1, 1);
public static MultiblockManager<SynchronizedTurbineData> turbineManager = new MultiblockManager<SynchronizedTurbineData>("industrialTurbine");

View file

@ -29,7 +29,7 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@Mod(modid = "MekanismTools", name = "MekanismTools", version = "9.1.0", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory")
@Mod(modid = "MekanismTools", name = "MekanismTools", version = "9.1.1", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory")
public class MekanismTools implements IModule
{
@SidedProxy(clientSide = "mekanism.tools.client.ToolsClientProxy", serverSide = "mekanism.tools.common.ToolsCommonProxy")
@ -39,7 +39,7 @@ public class MekanismTools implements IModule
public static MekanismTools instance;
/** MekanismTools version number */
public static Version versionNumber = new Version(9, 1, 0);
public static Version versionNumber = new Version(9, 1, 1);
//Enums: Tools
public static ToolMaterial toolOBSIDIAN;