This repository was archived by the owner on Feb 19, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
src/main/java/clientapi/load Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,8 +106,8 @@ public final String[] getLaunchArguments() {
106106 // Parse the arguments that are already being passed to the game
107107 List <Argument > existing = Arguments .parse ((List <String >) Launch .blackboard .get ("ArgumentList" ));
108108
109- // Remove any arguments that match already existing ones
110- parsed .removeIf (argument -> existing .stream ().anyMatch (a -> a .matches (argument )));
109+ // Remove any arguments that conflict with existing ones
110+ parsed .removeIf (argument -> existing .stream ().anyMatch (a -> a .conflicts (argument )));
111111
112112 // Join back the filtered arguments and pass those to the game
113113 return Arguments .join (parsed ).toArray (new String [0 ]);
Original file line number Diff line number Diff line change 1919import java .util .List ;
2020
2121/**
22+ * A standard launch argument
23+ *
2224 * @author Brady
2325 * @since 10/9/2018
2426 */
2527public interface Argument {
2628
29+ /**
30+ * Adds the "components" of this argument to the specified list.
31+ *
32+ * @see ClassifiedArgument#addToList(List)
33+ * @see SingularArgument#addToList(List)
34+ *
35+ * @param arguments The argument list
36+ */
2737 void addToList (List <String > arguments );
2838
29- boolean matches (Argument argument );
39+ /**
40+ * Returns whether or not this argument conflicts with the specified one. In the context
41+ * of singular arguments, this means that the singular argument itself matches, in the context
42+ * of classified arguments, this means that the classifier matches.
43+ *
44+ * @param argument Another argument
45+ * @return Whether or not this argument conflicts
46+ */
47+ boolean conflicts (Argument argument );
3048}
Original file line number Diff line number Diff line change 2020import java .util .List ;
2121
2222/**
23+ * Helper for argument parsing
24+ *
2325 * @author Brady
2426 * @since 10/9/2018
2527 */
2628public final class Arguments {
2729
30+ /**
31+ * Parses a list of raw arguments into a list of joined classifier and singular ones.
32+ *
33+ * @param args The arguments to parse
34+ * @return The parsed arguments
35+ */
2836 public static List <Argument > parse (List <String > args ) {
2937 List <Argument > argsOut = new ArrayList <>();
3038
@@ -53,6 +61,12 @@ public static List<Argument> parse(List<String> args) {
5361 return argsOut ;
5462 }
5563
64+ /**
65+ * Joins a list of arguments back into a string list format
66+ *
67+ * @param args The arguments
68+ * @return The joined arguments
69+ */
5670 public static List <String > join (List <Argument > args ) {
5771 List <String > argsOut = new ArrayList <>();
5872 args .forEach (argument -> argument .addToList (argsOut ));
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public final class ClassifiedArgument implements Argument {
2727 private final String classifier ;
2828 private final String value ;
2929
30- public ClassifiedArgument (String classifier , String value ) {
30+ ClassifiedArgument (String classifier , String value ) {
3131 this .classifier = classifier ;
3232 this .value = value ;
3333 }
@@ -39,7 +39,7 @@ public final void addToList(List<String> arguments) {
3939 }
4040
4141 @ Override
42- public final boolean matches (Argument argument ) {
42+ public final boolean conflicts (Argument argument ) {
4343 if (!(argument instanceof ClassifiedArgument ))
4444 return false ;
4545
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public final class SingularArgument implements Argument {
2626
2727 private final String value ;
2828
29- public SingularArgument (String value ) {
29+ SingularArgument (String value ) {
3030 this .value = value ;
3131 }
3232
@@ -36,7 +36,7 @@ public final void addToList(List<String> arguments) {
3636 }
3737
3838 @ Override
39- public final boolean matches (Argument argument ) {
39+ public final boolean conflicts (Argument argument ) {
4040 if (!(argument instanceof SingularArgument ))
4141 return false ;
4242
You can’t perform that action at this time.
0 commit comments