From c220472d5acc34c806f4b7464c6c268136bfe7dc Mon Sep 17 00:00:00 2001 From: zaaarf Date: Fri, 31 May 2024 19:41:42 +0200 Subject: [PATCH] fix: assorted bugfixes --- build.gradle | 5 +++-- .../ftbsc/lll/mapper/writer/MappingWriter.java | 18 ++---------------- .../lll/mapper/writer/impl/TinyV2Writer.java | 4 ++-- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/build.gradle b/build.gradle index ae50b46..cdef96e 100644 --- a/build.gradle +++ b/build.gradle @@ -25,8 +25,8 @@ repositories { } dependencies { - implementation 'commons-cli:commons-cli:1.5.0' - implementation 'ftbsc.lll:mapper:0.4.0' + shadow(implementation 'commons-cli:commons-cli:1.5.0') + shadow(implementation 'ftbsc.lll:mapper:0.4.1') implementation 'com.google.auto.service:auto-service-annotations:1.1.0' annotationProcessor 'com.google.auto.service:auto-service:1.1.0' } @@ -38,6 +38,7 @@ jar { } shadowJar { + archiveClassifier = '' dependencies { exclude(dependency('com.google.auto.service:auto-service-annotations:1.1.0')) } diff --git a/src/main/java/ftbsc/lll/mapper/writer/MappingWriter.java b/src/main/java/ftbsc/lll/mapper/writer/MappingWriter.java index 36b117f..eb073b5 100644 --- a/src/main/java/ftbsc/lll/mapper/writer/MappingWriter.java +++ b/src/main/java/ftbsc/lll/mapper/writer/MappingWriter.java @@ -30,23 +30,9 @@ public class MappingWriter { args = cmdLine.getArgs(); //separate normal args from custom args - int cursor; - for(cursor = 0; cursor < args.length; cursor++) - if(args[cursor].equals("-a")) - break; - String[] customArgs; - if(cursor != args.length) { - int len = args.length - cursor - 1; - customArgs = new String[len]; - System.arraycopy(args, cursor + 1, customArgs, 0, len); - String[] newArgs = new String[cursor]; - System.arraycopy(args, 0, newArgs, 0, cursor); - args = newArgs; - } else customArgs = new String[0]; - if(args.length < 3) { System.err.println("Bad argument count!"); - System.err.println("java -jar mapping-writer.jar [-r] [-o] [-a ]"); + System.err.println("java -jar mapping-writer.jar [-r] [-o] [[custom args]]"); return; } @@ -85,7 +71,7 @@ public class MappingWriter { //call the writer PrintWriter printWriter = new PrintWriter(new FileWriter(targetFile)); - writer.write(mapper, printWriter, customArgs); + writer.write(mapper, printWriter, Arrays.copyOfRange(args, 3, args.length)); printWriter.close(); } } diff --git a/src/main/java/ftbsc/lll/mapper/writer/impl/TinyV2Writer.java b/src/main/java/ftbsc/lll/mapper/writer/impl/TinyV2Writer.java index 68d769a..d63db24 100644 --- a/src/main/java/ftbsc/lll/mapper/writer/impl/TinyV2Writer.java +++ b/src/main/java/ftbsc/lll/mapper/writer/impl/TinyV2Writer.java @@ -20,8 +20,8 @@ public class TinyV2Writer implements IWriter { @Override public void write(Mapper mapper, PrintWriter writer, String... args) { if(args.length < 2) - throw new RuntimeException("Please provide the namespaces for the tiny format after the -a flag!"); - writer.printf("tiny\t2\t0\t%s\t%s", args[0], args[1]); + throw new RuntimeException("Please provide the namespaces for the tiny format as additional arguments!"); + writer.printf("tiny\t2\t0\t%s\t%s\n", args[0], args[1]); mapper.getRawMappings().forEach((name, data) -> { writer.printf("c\t%s\t%s\n", name, data.nameMapped); data.getFields().forEach((fieldName, fieldData) ->