CLI: Support for passing a custom mods folder path (#617)

This commit is contained in:
TechnicJelle 2024-10-12 23:00:48 +02:00 committed by GitHub
parent f5e36ad923
commit b30cc4d868
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -72,6 +72,7 @@ public class BlueMapCLI {
private String minecraftVersion = null;
private Path configFolder = Path.of("config");
private Path modsFolder = null;
public void renderMaps(BlueMapService blueMap, boolean watch, Predicate<TileState> force, boolean forceGenerateWebapp,
@ -318,6 +319,14 @@ public static void main(String[] args) {
FileHelper.createDirectories(cli.configFolder);
}
//mods folder
if (cmd.hasOption("n")) {
cli.modsFolder = Path.of(cmd.getOptionValue("n"));
if (!Files.isDirectory(cli.modsFolder)) {
throw new ConfigurationException("Mods folder does not exist: " + cli.modsFolder);
}
}
//minecraft version
if (cmd.hasOption("v")) {
cli.minecraftVersion = cmd.getOptionValue("v");
@ -332,6 +341,7 @@ public static void main(String[] args) {
BlueMapConfigManager configs = BlueMapConfigManager.builder()
.minecraftVersion(cli.minecraftVersion)
.configRoot(cli.configFolder)
.modsFolder(cli.modsFolder)
.usePluginConfig(false)
.defaultDataFolder(Path.of("data"))
.defaultWebroot(Path.of("web"))
@ -435,6 +445,15 @@ private static Options createOptions() {
.build()
);
options.addOption(
Option.builder("n")
.longOpt("mods")
.hasArg()
.argName("mods-folder")
.desc("Sets path of the folder containing the mods that contain extra resources for rendering.")
.build()
);
options.addOption(
Option.builder("v")
.longOpt("mc-version")