builder.append( container.getVersion() );
private ModMeta(ModContainer container) { this.container = container; this.modId = Strings.nullToEmpty(container.getModId()); this.name = Strings.nullToEmpty(container.getName()); this.version = Strings.nullToEmpty(container.getVersion()); this.metadata = container.getMetadata(); }
public static String getDisplayString() { ModContainer metadata = FMLInterface.getModContainer(); return metadata.getName() + " " + metadata.getVersion(); } }
public boolean isUpToDate() throws UnknownVersionFormatException { try{ String[] version_split = mc.getVersion().split("\\."); int[] version = new int[version_split.length]; for(int i = 0; i < version.length; i++){ version[i] = Integer.parseInt(version_split[i]); } Release thisVersion = new Release(Release.EnumReleaseType.Normal, null, version, null); return (thisVersion.compareTo(latest) >= 0); } catch(NumberFormatException e){ throw new UnknownVersionFormatException(); } } }
/** * Basic version checker, support having different build number on each side * @param mods the data sent from FML handshake packet * @param remoteParty the side that sent this data * @return true if we allow this to run */ @NetworkCheckHandler public boolean checkRemote(Map<String,String> mods, Side remoteParty){ if(mods.containsKey(MODID)){ String remoteVersion = mods.get(MODID); if(remoteVersion!=null) { String internalVersion = FMLCommonHandler.instance().findContainerFor(this).getVersion(); if(remoteVersion.equals(internalVersion)) return true; else{ internalVersion = internalVersion.substring(0, internalVersion.lastIndexOf(".")); remoteVersion = remoteVersion.substring(0, remoteVersion.lastIndexOf(".")); return remoteVersion.equals(internalVersion); } } } return false; } }
public static boolean isModLoaded(String modId) { if (modId.contains("@")) { String version = modId.substring(modId.indexOf('@') + 1); modId = modId.substring(0, modId.indexOf('@')); if (Loader.isModLoaded(modId)) { ModContainer mod = Loader.instance().getIndexedModList().get(modId); if (mod != null) { return mod.getVersion().startsWith(version); } } return false; } else if (Loader.isModLoaded(modId)) { return true; } else { return ModAPIManager.INSTANCE.hasAPI(modId); } }
String clientVersion = mods.get(ModInfo.MODID); String ourVersionString = Loader.instance().getIndexedModList().get(ModInfo.MODID).getVersion(); if(ourVersionString.equals(clientVersion) || ourVersionString.startsWith("${version}") || clientVersion.startsWith("${version}")) { return true;
if( version.contains( imb.getVersion() ) )
public static boolean isModVersionEqualsOrHigher(String modId, String version) { ComparableVersion v1 = new ComparableVersion(version); ModContainer mod = Loader.instance().getIndexedModList().get(modId); if (mod != null) { ComparableVersion v2 = new ComparableVersion(mod.getVersion()); return v1.compareTo(v2) <= 0; } return false; } }
private void updateModInfo() { this.buttonUpdate.visible = false; this.modInfo = null; if (this.selected == -1) { return; } List<String> textList = new ArrayList<>(); this.buttonUpdate.visible = true; this.buttonUpdate.enabled = true; this.buttonUpdate.displayString = I18n.format("gui.llibrary.update"); UpdateContainer updateContainer = UpdateHandler.INSTANCE.getOutdatedModList().get(this.selected); textList.add(updateContainer.getModContainer().getName()); textList.add(I18n.format("gui.llibrary.currentVersion") + String.format(": %s", updateContainer.getModContainer().getVersion())); textList.add(I18n.format("gui.llibrary.latestVersion") + String.format(": %s", updateContainer.getLatestVersion().getVersionString())); textList.add(null); Collections.addAll(textList, UpdateHandler.INSTANCE.getChangelog(updateContainer, updateContainer.getLatestVersion())); this.modInfo = new ModUpdateEntryGUI(this, this.width - this.modList.getWidth() - 30, textList); }
if (mod != null) { VersionRange range = VersionParser.parseRange(version); ArtifactVersion artifactVersion = new DefaultArtifactVersion("Version", mod.getVersion()); loaded = range.containsVersion(artifactVersion); } else {
String apiVersionString = modContainer.getVersion(); if (apiVersionString == null) { apiVersionString = "";
@Override public void initGui() { int width = 0; for (UpdateContainer mod : UpdateHandler.INSTANCE.getOutdatedModList()) { width = Math.max(width, this.fontRenderer.getStringWidth(mod.getModContainer().getName()) + 47); width = Math.max(width, this.fontRenderer.getStringWidth(mod.getModContainer().getVersion()) + 47); } width = Math.min(width, 150); this.modList = new ModUpdateListGUI(this, width); this.buttonList.add(this.buttonDone = new GuiButton(6, ((this.modList.getRight() + this.width) / 2) - 100, this.height - 38, I18n.format("gui.done"))); this.buttonList.add(this.buttonUpdate = new GuiButton(20, 10, this.height - 38, this.modList.getWidth(), 20, I18n.format("gui.llibrary.update"))); this.updateModInfo(); }
@Override public boolean init() { List<ModContainer> modList = Loader.instance().getModList(); for (ModContainer mod : modList) { if (mod.getModId().equals("StorageDrawers")) { try { VersionRange validVersions = VersionRange.createFromVersionSpec("[1.7.8,)"); ArtifactVersion version = new DefaultArtifactVersion(mod.getVersion()); return validVersions.containsVersion(version); } catch (InvalidVersionSpecificationException e) { return false; } } } return false; }
@EventHandler public void serverStart(FMLServerStartingEvent event) { MinecraftServer server = event.getServer(); ICommandManager command = server.getCommandManager(); ServerCommandManager manager = (ServerCommandManager) command; manager.registerCommand(new BQ_CommandAdmin()); manager.registerCommand(new BQ_CommandUser()); ModContainer activeMod = Loader.instance().activeModContainer(); if(activeMod != null && "${version}".equalsIgnoreCase(activeMod.getVersion())) { manager.registerCommand(new BQ_CommandDebug()); } SaveLoadHandler.INSTANCE.loadDatabases(server); }
jsonCon.setString("build", Loader.instance().activeModContainer().getVersion());
String cVer = Loader.instance().activeModContainer().getVersion();