Update some stuff
Dieser Commit ist enthalten in:
Ursprung
0bd3f2bd88
Commit
2a2dbd9458
@ -170,7 +170,7 @@ public abstract class AbstractSWCommand<T> {
|
|||||||
if (compare != 0) {
|
if (compare != 0) {
|
||||||
return compare;
|
return compare;
|
||||||
} else {
|
} else {
|
||||||
return Double.compare(o1.comparableValue, o2.comparableValue);
|
return Integer.compare(o1.comparableValue, o2.comparableValue);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
commandHelpList.sort((o1, o2) -> {
|
commandHelpList.sort((o1, o2) -> {
|
||||||
|
@ -23,7 +23,6 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Parameter;
|
import java.lang.reflect.Parameter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@ -31,14 +30,6 @@ import java.util.function.Predicate;
|
|||||||
|
|
||||||
public class SubCommand<T> {
|
public class SubCommand<T> {
|
||||||
|
|
||||||
private static Map<Class<?>, Double> increment = new HashMap<>();
|
|
||||||
static {
|
|
||||||
increment.put(double.class, 0.1);
|
|
||||||
increment.put(Double.class, 0.1);
|
|
||||||
increment.put(float.class, 0.1);
|
|
||||||
increment.put(Float.class, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private AbstractSWCommand<T> abstractSWCommand;
|
private AbstractSWCommand<T> abstractSWCommand;
|
||||||
Method method;
|
Method method;
|
||||||
String[] description;
|
String[] description;
|
||||||
@ -47,7 +38,7 @@ public class SubCommand<T> {
|
|||||||
private Function<T, ?> senderFunction;
|
private Function<T, ?> senderFunction;
|
||||||
AbstractGuardChecker<T> guardChecker;
|
AbstractGuardChecker<T> guardChecker;
|
||||||
boolean noTabComplete;
|
boolean noTabComplete;
|
||||||
double comparableValue;
|
int comparableValue;
|
||||||
|
|
||||||
private CommandPart<T> commandPart;
|
private CommandPart<T> commandPart;
|
||||||
|
|
||||||
@ -60,9 +51,6 @@ public class SubCommand<T> {
|
|||||||
|
|
||||||
Parameter[] parameters = method.getParameters();
|
Parameter[] parameters = method.getParameters();
|
||||||
comparableValue = parameters[parameters.length - 1].isVarArgs() ? Integer.MAX_VALUE : -parameters.length;
|
comparableValue = parameters[parameters.length - 1].isVarArgs() ? Integer.MAX_VALUE : -parameters.length;
|
||||||
for (Parameter parameter : parameters) {
|
|
||||||
comparableValue += increment.getOrDefault(parameter.getType(), 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
guardChecker = SWCommandUtils.getGuardChecker(parameters[0], localGuardChecker);
|
guardChecker = SWCommandUtils.getGuardChecker(parameters[0], localGuardChecker);
|
||||||
|
|
||||||
|
@ -3,3 +3,5 @@ build:
|
|||||||
- "cp ~/gradle.properties ."
|
- "cp ~/gradle.properties ."
|
||||||
- "chmod u+x build.gradle"
|
- "chmod u+x build.gradle"
|
||||||
- "./gradlew buildProject"
|
- "./gradlew buildProject"
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
@ -39,7 +39,7 @@ public class ArgumentCommand extends TestSWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void argument(String sender, double d, double d2) {
|
public void argument(String sender, double d, double d2, double d3, double d4) {
|
||||||
throw new ExecutionIdentifier("RunArgument with Double");
|
throw new ExecutionIdentifier("RunArgument with Double");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class ArgumentCommandTest {
|
|||||||
public void testDouble() {
|
public void testDouble() {
|
||||||
ArgumentCommand cmd = new ArgumentCommand();
|
ArgumentCommand cmd = new ArgumentCommand();
|
||||||
try {
|
try {
|
||||||
cmd.execute("test", "", new String[]{"0.0", "0.0"});
|
cmd.execute("test", "", new String[]{"0.0", "0.0", "0.0", "0.0"});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Double");
|
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Double");
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren