Merge pull request #1872 from Dynious/6.0.x

Made sure Version IMC message is also sent after init phase
This commit is contained in:
SpaceToad 2014-06-11 01:36:12 +02:00
commit 4931bc2954

View file

@ -19,6 +19,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.Loader;
import net.minecraftforge.common.config.Property; import net.minecraftforge.common.config.Property;
@ -225,24 +226,27 @@ public class Version implements Runnable {
/** /**
* This is an integration with Dynious Version Checker See * This is an integration with Dynious Version Checker See
* http://www.minecraftforum.net/topic/2721902-172 * http://www.minecraftforum.net/topic/2721902-
*/ */
public static void sendIMCOutdatedMessage() { public static void sendIMCOutdatedMessage() {
NBTTagCompound compound = new NBTTagCompound(); if (Loader.isModLoaded("VersionChecker")) {
compound.setString("modDisplayName", "BuildCraft"); NBTTagCompound compound = new NBTTagCompound();
compound.setString("oldVersion", VERSION); compound.setString("modDisplayName", "BuildCraft");
compound.setString("newVersion", getRecommendedVersion()); compound.setString("oldVersion", VERSION);
compound.setString("newVersion", getRecommendedVersion());
compound.setString("updateUrl", "http://www.mod-buildcraft.com/download/"); compound.setString("updateUrl", "http://www.mod-buildcraft.com/download/");
compound.setBoolean("isDirectLink", false); compound.setBoolean("isDirectLink", false);
String changeLogString = ""; StringBuilder stringBuilder = new StringBuilder();
for (String changeLogLine : getChangelog()) { for (String changeLogLine : getChangelog()) {
changeLogString = changeLogString + changeLogLine + "\n"; stringBuilder.append(changeLogLine).append("\n");
}
compound.setString("changeLog", stringBuilder.toString());
FMLInterModComms.sendRuntimeMessage("BuildCraft|Core", "VersionChecker", "addUpdate", compound);
sentIMCOutdatedMessage = true;
} }
compound.setString("changeLog", changeLogString);
sentIMCOutdatedMessage = FMLInterModComms.sendMessage("VersionChecker", "addUpdate", compound);
} }
public static void displayChangelog(ICommandSender sender) { public static void displayChangelog(ICommandSender sender) {