diff --git a/src/main/java/forestry/core/commands/CommandVersion.java b/src/main/java/forestry/core/commands/CommandVersion.java index 58bc1c297..d5504df50 100644 --- a/src/main/java/forestry/core/commands/CommandVersion.java +++ b/src/main/java/forestry/core/commands/CommandVersion.java @@ -26,24 +26,11 @@ public class CommandVersion extends SubCommand { @Override public void processSubCommand(ICommandSender sender, String[] args) { - ChatStyle style = new ChatStyle(); - if (Version.isOutdated()) { - style.setColor(EnumChatFormatting.RED); - } else { - style.setColor(EnumChatFormatting.GREEN); - } - CommandHelpers.sendLocalizedChatMessage( sender, - style, + new ChatStyle().setColor(EnumChatFormatting.GREEN), "for.chat.version", Version.getVersion(), - Proxies.common.getMinecraftVersion(), - Version.getRecommendedVersion()); - if (Version.isOutdated()) { - for (String updateLine : Version.getChangelog()) { - CommandHelpers.sendChatMessage(sender, EnumChatFormatting.BLUE + updateLine); - } - } + Proxies.common.getMinecraftVersion()); } } diff --git a/src/main/java/forestry/core/config/Constants.java b/src/main/java/forestry/core/config/Constants.java index 61625d7e3..165a2cf3f 100644 --- a/src/main/java/forestry/core/config/Constants.java +++ b/src/main/java/forestry/core/config/Constants.java @@ -8,6 +8,7 @@ ******************************************************************************/ package forestry.core.config; +import forestry.Tags; import forestry.api.core.IForestryConstants; public class Constants implements IForestryConstants { @@ -15,7 +16,7 @@ public class Constants implements IForestryConstants { // System public static final String MOD = "Forestry"; public static final String ID = "forestry"; - public static final String VERSION = "GRADLETOKEN_VERSION"; + public static final String VERSION = Tags.VERSION; public static final String URL = "http://forestry.sengir.net/"; public static final int FLAG_BLOCK_UPDATE = 1; diff --git a/src/main/java/forestry/core/config/Version.java b/src/main/java/forestry/core/config/Version.java index 155589a98..bbea27031 100755 --- a/src/main/java/forestry/core/config/Version.java +++ b/src/main/java/forestry/core/config/Version.java @@ -8,21 +8,7 @@ ******************************************************************************/ package forestry.core.config; -import java.io.BufferedReader; -import java.io.File; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.ArrayList; - -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.versioning.DefaultArtifactVersion; -import forestry.Forestry; -import forestry.core.proxy.Proxies; -import forestry.core.utils.Log; +import forestry.Tags; /** * With permission from pahimar. @@ -31,163 +17,51 @@ import forestry.core.utils.Log; */ public class Version { + @Deprecated public enum EnumUpdateState { CURRENT, OUTDATED, CONNECTION_ERROR } - public static final String VERSION = "@VERSION@"; - public static final String BUILD_NUMBER = "@BUILD_NUMBER@"; + public static final String VERSION = Tags.VERSION; + @Deprecated + public static final String BUILD_NUMBER = ""; + @Deprecated public static final String[] FAILED_CHANGELOG = new String[] { String.format("Unable to retrieve changelog for %s", Constants.MOD) }; - private static final String REMOTE_VERSION_FILE = "http://bit.ly/forestryver"; - private static final String REMOTE_CHANGELOG_ROOT = "https://dl.dropbox.com/u/44760587/forestry/changelog/"; + @Deprecated public static EnumUpdateState currentVersion = EnumUpdateState.CURRENT; - private static String recommendedVersion; - private static String[] cachedChangelog = FAILED_CHANGELOG; public static String getVersion() { - return VERSION + " (" + BUILD_NUMBER + ")"; + return VERSION; } + @Deprecated public static boolean isOutdated() { - return currentVersion == EnumUpdateState.OUTDATED; + return false; } + @Deprecated public static boolean needsUpdateNoticeAndMarkAsSeen() { - if (!isOutdated()) { - return false; - } - - File versionFile = new File(Forestry.instance.getConfigFolder(), Config.CATEGORY_COMMON + ".cfg"); - Configuration config = new Configuration(versionFile); - Property property = config.get("version", "seen", VERSION); - property.comment = "indicates the last version the user has been informed about and will suppress further notices on it."; - String seenVersion = property.getString(); - - if (recommendedVersion == null || recommendedVersion.equals(seenVersion)) { - return false; - } - - property.set(recommendedVersion); - config.save(); - return true; + return false; } + @Deprecated public static String getRecommendedVersion() { - return recommendedVersion; + return VERSION; } - private static class VersionChecker extends Thread { - - @Override - public void run() { - try { - String location = REMOTE_VERSION_FILE; - HttpURLConnection conn = null; - while (location != null && !location.isEmpty()) { - URL url = new URL(location); - conn = (HttpURLConnection) url.openConnection(); - conn.setRequestProperty( - "User-Agent", - "Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)"); - conn.connect(); - location = conn.getHeaderField("Location"); - } - - BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); - - String line; - String mcVersion = Proxies.common.getMinecraftVersion(); - while ((line = reader.readLine()) != null) { - if (line.startsWith(mcVersion) && line.contains(Constants.MOD)) { - String[] tokens = line.split(":"); - recommendedVersion = tokens[2]; - } - } - - if (recommendedVersion == null) { - return; - } - - int result = FMLCommonHandler.instance().findContainerFor(Forestry.instance).getProcessedVersion() - .compareTo(new DefaultArtifactVersion(recommendedVersion)); - if (result >= 0) { - Log.finer( - "Using the latest version [" + VERSION - + " (build:" - + BUILD_NUMBER - + ")] for Minecraft " - + mcVersion); - currentVersion = EnumUpdateState.CURRENT; - return; - } - - cachedChangelog = grabChangelog(recommendedVersion); - - Log.warning( - "Using outdated version [" + VERSION - + " (build:" - + BUILD_NUMBER - + ")] for Minecraft " - + mcVersion - + ". Consider updating."); - currentVersion = EnumUpdateState.OUTDATED; - - } catch (Exception e) { - // e.printStackTrace(); - Log.warning("Unable to read from remote version authority."); - currentVersion = EnumUpdateState.CONNECTION_ERROR; - } - } - } - - public static void versionCheck() { - new VersionChecker().start(); - } + @Deprecated + public static void versionCheck() {} + @Deprecated public static String[] getChangelog() { - return cachedChangelog; + return FAILED_CHANGELOG; } + @Deprecated public static String[] grabChangelog(String version) { - - try { - String location = REMOTE_CHANGELOG_ROOT + version; - HttpURLConnection conn; - do { - URL url = new URL(location); - conn = (HttpURLConnection) url.openConnection(); - conn.setRequestProperty( - "User-Agent", - "Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)"); - conn.connect(); - location = conn.getHeaderField("Location"); - } while (location != null && !location.isEmpty()); - - BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); - - String line; - ArrayList changelog = new ArrayList<>(); - while ((line = reader.readLine()) != null) { - if (line.startsWith("#")) { - continue; - } - if (line.isEmpty()) { - continue; - } - - changelog.add(line); - } - - return changelog.toArray(new String[changelog.size()]); - - } catch (Exception ex) { - // ex.printStackTrace(); - Log.warning("Unable to read changelog from remote site."); - } - - return new String[] { String.format("Unable to retrieve changelog for %s %s", Constants.MOD, version) }; + return FAILED_CHANGELOG; } } diff --git a/src/main/resources/assets/forestry/lang/de_DE.lang b/src/main/resources/assets/forestry/lang/de_DE.lang index 11deb4a6d..0b1f31369 100644 --- a/src/main/resources/assets/forestry/lang/de_DE.lang +++ b/src/main/resources/assets/forestry/lang/de_DE.lang @@ -36,7 +36,7 @@ for.chat.command.forestry.plugins.info.format=Format: /%s for.chat.help=Gib '%s' für Hilfe ein. for.chat.plugins.error=Keine Informationen für das Plugin %s verfügbar. -for.chat.version=Forestry %1$s für Minecraft %2$s (Aktuell: %3$s). +for.chat.version=Forestry %1$s für Minecraft %2$s. for.circuit.dampener.1=Feuerdämpfer for.circuit.dampener.1.description.1=Reduziert maximalen Output auf 10 RF/t diff --git a/src/main/resources/assets/forestry/lang/en_US.lang b/src/main/resources/assets/forestry/lang/en_US.lang index cbf654f67..d73fb3068 100644 --- a/src/main/resources/assets/forestry/lang/en_US.lang +++ b/src/main/resources/assets/forestry/lang/en_US.lang @@ -36,7 +36,7 @@ for.chat.command.forestry.plugins.info.format=Format: /%s for.chat.help=Type '%s' for help. for.chat.plugins.error=No information available for plugin %s. -for.chat.version=Forestry %1$s for Minecraft %2$s (Latest: %3$s). +for.chat.version=Forestry %1$s for Minecraft %2$s. for.circuit.dampener.1=Fire Dampener for.circuit.dampener.1.description.1=Reduces maximum output to 10 RF/t diff --git a/src/main/resources/assets/forestry/lang/fr_FR.lang b/src/main/resources/assets/forestry/lang/fr_FR.lang index 6f55eadd8..788c4326d 100644 --- a/src/main/resources/assets/forestry/lang/fr_FR.lang +++ b/src/main/resources/assets/forestry/lang/fr_FR.lang @@ -36,7 +36,7 @@ for.chat.command.forestry.plugins.info.format=Format: /%s for.chat.help=Tapez '%s' pour l'aide. for.chat.plugins.error=Pas d'information sur le module %s. -for.chat.version=Forestry %1$s pour Minecraft %2$s (Dernier: %3$s). +for.chat.version=Forestry %1$s pour Minecraft %2$s. for.circuit.dampener.1=Clapet coupe-feu for.circuit.dampener.1.description.1=Limite la sortie à 10 RF/t maximum diff --git a/src/main/resources/assets/forestry/lang/ko_KR.lang b/src/main/resources/assets/forestry/lang/ko_KR.lang index b41a936a4..ac23f943f 100644 --- a/src/main/resources/assets/forestry/lang/ko_KR.lang +++ b/src/main/resources/assets/forestry/lang/ko_KR.lang @@ -35,7 +35,7 @@ for.chat.command.forestry.plugins.info.format=Format: /%s for.chat.help='%s'에 관한 도움. for.chat.memorizednote=내용을 완전히 외우고 당신은 비밀이 새어나가는걸 막기 위해 이 종이를 버렸습니다. for.chat.plugins.error=해당 플러그인[ %s ]에 관한 정보가 존재하지 않습니다. -for.chat.version=마인크래프트 %2$s버전 포레스트리 %1$s버전이 나왔습니다.(최신 버전: %3$s). +for.chat.version=마인크래프트 %2$s버전 포레스트리 %1$s버전이 나왔습니다. for.circuit.dampener.1=과열완충 for.circuit.dampener.1.description.1=10 RF/t만큼 최대출력 감소 diff --git a/src/main/resources/assets/forestry/lang/pt_BR.lang b/src/main/resources/assets/forestry/lang/pt_BR.lang index 76ded7e87..767f65782 100644 --- a/src/main/resources/assets/forestry/lang/pt_BR.lang +++ b/src/main/resources/assets/forestry/lang/pt_BR.lang @@ -35,7 +35,7 @@ for.chat.command.forestry.plugins.info.format=Formato: /%s for.chat.help=Digite '%s' para obter ajuda. for.chat.memorizednote=Você memorizá a nota e descartará papel amassado. for.chat.plugins.error=Não há informações disponíveis para o ´plugin´ %s. -for.chat.version=Forestry %1$s para Minecraft %2$s (Mais recente: %3$s). +for.chat.version=Forestry %1$s para Minecraft %2$s. for.circuit.dampener.1=Regulador de Tiragem for.circuit.dampener.1.description.1=Reduz a saída máxima para 10 RF/t diff --git a/src/main/resources/assets/forestry/lang/ru_RU.lang b/src/main/resources/assets/forestry/lang/ru_RU.lang index 961c22a99..0203e22ec 100644 --- a/src/main/resources/assets/forestry/lang/ru_RU.lang +++ b/src/main/resources/assets/forestry/lang/ru_RU.lang @@ -36,7 +36,7 @@ for.chat.command.forestry.plugins.info.format=Формат: /%s for.chat.help=Напишите '%s' для помощи. for.chat.plugins.error=Нет информации для плагина %s. -for.chat.version=Forestry %1$s для Minecraft %2$s (Последняя: %3$s). +for.chat.version=Forestry %1$s для Minecraft %2$s. for.circuit.dampener.1=Демпфер огня for.circuit.dampener.1.description.1=Понижает максимальную выходную мощность до 10 RF/тик diff --git a/src/main/resources/assets/forestry/lang/uk_UA.lang b/src/main/resources/assets/forestry/lang/uk_UA.lang index f9f059d84..c1b4e85bf 100644 --- a/src/main/resources/assets/forestry/lang/uk_UA.lang +++ b/src/main/resources/assets/forestry/lang/uk_UA.lang @@ -35,7 +35,7 @@ for.chat.command.forestry.plugins.info.format=Формат: /%s for.chat.help=Напишите '%s' для помощи. for.chat.memorizednote=Вы запоминаете записку и избавляетесь от мятого клочка бумаги. for.chat.plugins.error=Нет информации для плагина %s. -for.chat.version=Forestry %1$s для Minecraft %2$s (Последняя: %3$s). +for.chat.version=Forestry %1$s для Minecraft %2$s. for.circuit.dampener.1=Демпфер огня for.circuit.dampener.1.description.1=Уменьшает максимальную выходную мощность до 10 RF/тик diff --git a/src/main/resources/assets/forestry/lang/zh_CN.lang b/src/main/resources/assets/forestry/lang/zh_CN.lang index e9c7238a8..e76f14792 100644 --- a/src/main/resources/assets/forestry/lang/zh_CN.lang +++ b/src/main/resources/assets/forestry/lang/zh_CN.lang @@ -36,7 +36,7 @@ for.chat.command.forestry.plugins.info.format=格式: /%s for.chat.help=输入‘%s’查看帮助。 for.chat.plugins.error=拓展%s并无可查看信息。 -for.chat.version=林业%1$s适用于Minecraft%2$s(最新版本:%3$s)。 +for.chat.version=林业%1$s适用于Minecraft%2$s。 for.circuit.dampener.1=阻尼 for.circuit.dampener.1.description.1=最大输出减少到10RF/t diff --git a/src/main/resources/assets/forestry/lang/zh_TW.lang b/src/main/resources/assets/forestry/lang/zh_TW.lang index ed566a560..e782b4107 100644 --- a/src/main/resources/assets/forestry/lang/zh_TW.lang +++ b/src/main/resources/assets/forestry/lang/zh_TW.lang @@ -36,7 +36,7 @@ for.chat.command.forestry.plugins.info.format=格式: /%s for.chat.help=輸入'%s'檢視說明。 for.chat.plugins.error=插件%s沒有說明可顯示。 -for.chat.version=林業%1$s適用於Minecraft%2$s (最新版本: %3$s)。 +for.chat.version=林業%1$s適用於Minecraft%2$s。 for.circuit.dampener.1=阻尼 for.circuit.dampener.1.description.1=最大輸出減少到10 RF/t