}
@Override
public void run()
{
final Side sideToCheck = FMLCommonHandler.instance().getSide();
if (sideToCheck == null)
{
return;
}
while (this.count < 3 && remoteBuildVer == 0)
{
try
{
final URL url = new URL("http://micdoodle8.com/galacticraft/version.html");
final HttpURLConnection http = (HttpURLConnection) url.openConnection();
http.addRequestProperty("User-Agent", "Mozilla/4.76");
final BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));
String str;
String str2[] = null;
while ((str = in.readLine()) != null)
{
if (str.contains("Version"))
{
str = str.replace("Version=", "");
str2 = str.split("#");
if (str2.length == 3)
{
remoteMajVer = Integer.parseInt(str2[0]);
remoteMinVer = Integer.parseInt(str2[1]);
remoteBuildVer = Integer.parseInt(str2[2]);
}
if (remoteMajVer > Constants.LOCALMAJVERSION || remoteMajVer == Constants.LOCALMAJVERSION && remoteMinVer > Constants.LOCALMINVERSION || remoteMajVer == Constants.LOCALMAJVERSION && remoteMinVer == Constants.LOCALMINVERSION && remoteBuildVer > Constants.LOCALBUILDVERSION)
{
Thread.sleep(5000);
if (sideToCheck.equals(Side.CLIENT))
{
FMLClientHandler.instance().getClient().thePlayer.addChatMessage(new ChatComponentText(EnumColor.GREY + "New " + EnumColor.DARK_AQUA + "Galacticraft" + EnumColor.GREY + " version available! v" + String.valueOf(remoteMajVer) + "." + String.valueOf(remoteMinVer) + "." + String.valueOf(remoteBuildVer) + EnumColor.DARK_BLUE + " http://micdoodle8.com/"));
}
else if (sideToCheck.equals(Side.SERVER))
{
GCLog.severe("New Galacticraft version available! v" + String.valueOf(remoteMajVer) + "." + String.valueOf(remoteMinVer) + "." + String.valueOf(remoteBuildVer) + " http://micdoodle8.com/");
}
}
}