Merge branch '6.0.x' into 6.1.x
This commit is contained in:
commit
aeef94a888
1 changed files with 34 additions and 2 deletions
|
@ -15,8 +15,12 @@ import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import net.minecraft.command.ICommandSender;
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
|
|
||||||
import net.minecraftforge.common.config.Property;
|
import net.minecraftforge.common.config.Property;
|
||||||
|
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
|
@ -45,6 +49,8 @@ public class Version implements Runnable {
|
||||||
|
|
||||||
private static Version instance = new Version();
|
private static Version instance = new Version();
|
||||||
|
|
||||||
|
private static boolean sentIMCOutdatedMessage = false;
|
||||||
|
|
||||||
public static String getVersion() {
|
public static String getVersion() {
|
||||||
return VERSION;
|
return VERSION;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +60,7 @@ public class Version implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean needsUpdateNoticeAndMarkAsSeen() {
|
public static boolean needsUpdateNoticeAndMarkAsSeen() {
|
||||||
if (!isOutdated()) {
|
if (!isOutdated() || sentIMCOutdatedMessage) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,6 +130,7 @@ public class Version implements Runnable {
|
||||||
BCLog.logger.warning("Using outdated version [" + VERSION + "] for Minecraft " + mcVersion
|
BCLog.logger.warning("Using outdated version [" + VERSION + "] for Minecraft " + mcVersion
|
||||||
+ ". Consider updating to " + recommendedVersion + ".");
|
+ ". Consider updating to " + recommendedVersion + ".");
|
||||||
currentVersion = EnumUpdateState.OUTDATED;
|
currentVersion = EnumUpdateState.OUTDATED;
|
||||||
|
sendIMCOutdatedMessage();
|
||||||
|
|
||||||
conn.disconnect();
|
conn.disconnect();
|
||||||
reader.close();
|
reader.close();
|
||||||
|
@ -145,7 +152,7 @@ public class Version implements Runnable {
|
||||||
public static String[] grabChangelog(String version) {
|
public static String[] grabChangelog(String version) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String location = REMOTE_CHANGELOG_ROOT + "/" + version;
|
String location = REMOTE_CHANGELOG_ROOT + version;
|
||||||
HttpURLConnection conn = null;
|
HttpURLConnection conn = null;
|
||||||
while (location != null && !location.isEmpty()) {
|
while (location != null && !location.isEmpty()) {
|
||||||
URL url = new URL(location);
|
URL url = new URL(location);
|
||||||
|
@ -217,6 +224,31 @@ public class Version implements Runnable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is an integration with Dynious Version Checker See
|
||||||
|
* http://www.minecraftforum.net/topic/2721902-
|
||||||
|
*/
|
||||||
|
public static void sendIMCOutdatedMessage() {
|
||||||
|
if (Loader.isModLoaded("VersionChecker")) {
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
compound.setString("modDisplayName", "BuildCraft");
|
||||||
|
compound.setString("oldVersion", VERSION);
|
||||||
|
compound.setString("newVersion", getRecommendedVersion());
|
||||||
|
|
||||||
|
compound.setString("updateUrl", "http://www.mod-buildcraft.com/download/");
|
||||||
|
compound.setBoolean("isDirectLink", false);
|
||||||
|
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
for (String changeLogLine : getChangelog()) {
|
||||||
|
stringBuilder.append(changeLogLine).append("\n");
|
||||||
|
}
|
||||||
|
compound.setString("changeLog", stringBuilder.toString());
|
||||||
|
|
||||||
|
FMLInterModComms.sendRuntimeMessage("BuildCraft|Core", "VersionChecker", "addUpdate", compound);
|
||||||
|
sentIMCOutdatedMessage = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void displayChangelog(ICommandSender sender) {
|
public static void displayChangelog(ICommandSender sender) {
|
||||||
int nb = 0;
|
int nb = 0;
|
||||||
for (String updateLine : Version.getChangelog()) {
|
for (String updateLine : Version.getChangelog()) {
|
||||||
|
|
Loading…
Reference in a new issue