Add Quotable strings
Dieser Commit ist enthalten in:
Ursprung
d38ddb54c7
Commit
2ae13e3642
@ -103,10 +103,12 @@ public class SWCommandUtils {
|
||||
Class<?> varArgType = parameter.isVarArgs() ? parameter.getType().getComponentType() : null;
|
||||
AbstractSWCommand.OptionalValue optionalValue = parameter.getAnnotation(AbstractSWCommand.OptionalValue.class);
|
||||
AbstractSWCommand.AllowNull allowNull = parameter.getAnnotation(AbstractSWCommand.AllowNull.class);
|
||||
AbstractSWCommand.Quotable quotable = parameter.getAnnotation(AbstractSWCommand.Quotable.class);
|
||||
|
||||
CommandPart<T> commandPart = new CommandPart<>(command, typeMapper, validator, varArgType, optionalValue != null ? optionalValue.value() : null, parameter, i);
|
||||
commandPart.setOnlyUseIfNoneIsGiven(optionalValue != null && optionalValue.onlyUINIG());
|
||||
commandPart.setAllowNullValues(allowNull != null);
|
||||
commandPart.setQuotable(quotable != null);
|
||||
if (current != null) {
|
||||
current.setNext(commandPart);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class ArgumentCommand extends TestSWCommand {
|
||||
}
|
||||
|
||||
@Register
|
||||
public void argument(String sender, String arg) {
|
||||
public void argument(String sender, @Quotable String arg) {
|
||||
throw new ExecutionIdentifier("RunArgument with String");
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ public class ArgumentCommandTest {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"true", "false"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Boolean");
|
||||
}
|
||||
@ -54,6 +55,7 @@ public class ArgumentCommandTest {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"0.0", "0.0", "0.0"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Float");
|
||||
}
|
||||
@ -64,6 +66,7 @@ public class ArgumentCommandTest {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"0.0", "0.0", "0.0", "0.0"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Double");
|
||||
}
|
||||
@ -74,6 +77,7 @@ public class ArgumentCommandTest {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"0"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Integer");
|
||||
}
|
||||
@ -84,6 +88,7 @@ public class ArgumentCommandTest {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"0", "0"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with Long");
|
||||
}
|
||||
@ -94,11 +99,22 @@ public class ArgumentCommandTest {
|
||||
ArgumentCommand cmd = new ArgumentCommand();
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"Hello World"});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with String");
|
||||
}
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"\"Hello World\""});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with String");
|
||||
}
|
||||
try {
|
||||
cmd.execute("test", "", new String[]{"\"Hello", "World\""});
|
||||
assert false;
|
||||
} catch (Exception e) {
|
||||
assertCMDFramework(e, ExecutionIdentifier.class, "RunArgument with String");
|
||||
}
|
||||
cmd.execute("test", "", new String[]{"\"Hello World\""});
|
||||
cmd.execute("test", "", new String[]{"\"Hello", "World\""});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren