Last active
February 25, 2018 04:55
-
-
Save Ricket/48419c80f540aeb2b9621db882409333 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/main/java/org/mcupdater/util/ServerDefinition.java b/src/main/java/org/mcupdater/util/ServerDefinition.java | |
index 8e288f0..69fd8b6 100644 | |
--- a/src/main/java/org/mcupdater/util/ServerDefinition.java | |
+++ b/src/main/java/org/mcupdater/util/ServerDefinition.java | |
@@ -1,5 +1,6 @@ | |
package org.mcupdater.util; | |
+import com.google.common.base.Joiner; | |
import org.apache.commons.codec.language.Soundex; | |
import org.apache.commons.lang3.StringUtils; | |
import org.mcupdater.api.Version; | |
@@ -31,21 +32,43 @@ public class ServerDefinition { | |
} | |
private void initExceptions() { | |
+ // key is exact mod id | |
+ // value is new mod id to replace with | |
modExceptions.put("NotEnoughItems", "NEI"); | |
modExceptions.put("AWWayofTime", "BloodMagic"); | |
modExceptions.put("WR-CBE|Core", "WirelessRedstone"); | |
modExceptions.put("TConstruct", "TinkersWorkshop"); | |
modExceptions.put("inventorytweaks", "InvTweaks"); | |
modExceptions.put("ProjRed|Core", "ProjectRed"); | |
+ modExceptions.put("Simple-Void-World-.-...-universal", "simplevoidworld"); | |
+ modExceptions.put("ImmersiveEngineering-.--core", "immersiveengineeringcore"); | |
+ modExceptions.put("llor", "lloverlayreloaded"); | |
+ modExceptions.put("Signals-..-..--universal", "signals"); | |
+ modExceptions.put("wct", "wirelesscraftingterminal"); | |
+ | |
+ // key is search string from config file path | |
+ // value is regex to match to the id of the Module it should associate with | |
configExceptions.put("AWWayofTime", "BloodMagic"); | |
configExceptions.put("microblocks", "ForgeMultipart"); | |
- configExceptions.put("cofh/world", "CoFHCore"); | |
- configExceptions.put("cofh/Lexicon-Whitelist", "CoFHCore"); | |
+ configExceptions.put("cofh/core", "cofhcore"); | |
+ configExceptions.put("cofh/world", "cofhworld"); | |
+ configExceptions.put("cofh/Lexicon-Whitelist", "cofhcore"); | |
configExceptions.put("hqm", "HardcoreQuesting"); | |
- configExceptions.put("forgeChunkLoading", "forge-\\d+.\\d+.\\d+.\\d+"); | |
- configExceptions.put("scripts", "MineTweaker3"); | |
- configExceptions.put(".zs", "MineTweaker3"); | |
+ configExceptions.put("config/forge.cfg", "forge-\\d+.\\d+.\\d+.\\d+"); | |
+ configExceptions.put("forgeChunkLoading.cfg", "forge-\\d+.\\d+.\\d+.\\d+"); | |
+ configExceptions.put("config/splash.properties", "forge-\\d+.\\d+.\\d+.\\d+"); | |
+ configExceptions.put("resources/assets/fml", "forge-\\d+.\\d+.\\d+.\\d+"); | |
+ configExceptions.put("scripts", "crafttweaker"); | |
+ configExceptions.put(".zs", "crafttweaker"); | |
configExceptions.put("resources", "ResourceLoader"); | |
+ configExceptions.put("advRocketry", "advancedRocketry"); | |
+ configExceptions.put("AppliedEnergistics2", "appliedenergistics2"); | |
+ configExceptions.put("resources/mainmenu", "custommainmenu"); | |
+ configExceptions.put("environmentaltech/etlunar", "etlunar"); | |
+ configExceptions.put("forestry/binniecore", "binniecore"); | |
+ configExceptions.put("rftools/control.cfg", "rftoolscontrol"); | |
+ configExceptions.put("sstow/", "soulshardstow"); | |
+ configExceptions.put("TinkerModules.cfg", "tconstruct"); | |
} | |
public void writeServerPack(String stylesheet, Path outputFile, List<Module> sortedModules, Boolean onlyOverrides) { | |
@@ -71,7 +94,15 @@ public class ServerDefinition { | |
"\">"); | |
fileWriter.newLine(); | |
for (Import importEntry : this.getImports()) { | |
- fileWriter.write("\t\t<Import" + (importEntry.getUrl().isEmpty() ? ">" : (" url=\"" + xmlEscape(importEntry.getUrl())) + "\">") + importEntry.getServerId() + "</Import>"); | |
+ List<String> params = new ArrayList<>(); | |
+ if (!importEntry.getUrl().isEmpty()) { | |
+ params.add(" url=\"" + xmlEscape(importEntry.getUrl()) + "\""); | |
+ } | |
+ if (importEntry.getMD5() != null) { | |
+ params.add(" md5=\"" + xmlEscape(importEntry.getMD5()) + "\""); | |
+ } | |
+ String paramStr = Joiner.on("").join(params); | |
+ fileWriter.write("\t\t<Import" + paramStr + ">" + importEntry.getServerId() + "</Import>"); | |
fileWriter.newLine(); | |
} | |
if (hasLitemods && !onlyOverrides) { | |
@@ -275,7 +306,7 @@ public class ServerDefinition { | |
int newDistance = StringUtils.getLevenshteinDistance(configName, mod.getId()); | |
for (Map.Entry<String, String> exception : configExceptions.entrySet()) { | |
if (config.getPath().contains(exception.getKey()) && mod.getId().matches(exception.getValue())) { | |
- newDistance -= 15; | |
+ newDistance -= 30; | |
} | |
} | |
if (configName.toLowerCase().contains(mod.getId().toLowerCase())) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment