🎨 Remove StaticArgument#Optional
Not needed with the introduction of the flag system. This closes #15.
This commit is contained in:
parent
a2670722e7
commit
eb07fd1a2f
2 changed files with 2 additions and 14 deletions
|
|
@ -61,19 +61,6 @@ public final class StaticArgument<C> extends CommandArgument<C, String> {
|
||||||
return new StaticArgument<>(true, name, aliases);
|
return new StaticArgument<>(true, name, aliases);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new static argument instance for an optional command argument
|
|
||||||
*
|
|
||||||
* @param name Argument name
|
|
||||||
* @param aliases Argument aliases
|
|
||||||
* @param <C> Command sender type
|
|
||||||
* @return Constructed argument
|
|
||||||
*/
|
|
||||||
public static <C> @NonNull StaticArgument<C> optional(final @NonNull String name,
|
|
||||||
final @NonNull String... aliases) {
|
|
||||||
return new StaticArgument<>(false, name, aliases);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new alias
|
* Register a new alias
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
package cloud.commandframework;
|
package cloud.commandframework;
|
||||||
|
|
||||||
import cloud.commandframework.arguments.StaticArgument;
|
import cloud.commandframework.arguments.StaticArgument;
|
||||||
|
import cloud.commandframework.arguments.standard.StringArgument;
|
||||||
import cloud.commandframework.meta.SimpleCommandMeta;
|
import cloud.commandframework.meta.SimpleCommandMeta;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
@ -38,7 +39,7 @@ class CommandTest {
|
||||||
@Test
|
@Test
|
||||||
void ensureOrdering() {
|
void ensureOrdering() {
|
||||||
Assertions.assertThrows(IllegalArgumentException.class, () ->
|
Assertions.assertThrows(IllegalArgumentException.class, () ->
|
||||||
Command.newBuilder("test", SimpleCommandMeta.empty()).argument(StaticArgument.optional("something"))
|
Command.newBuilder("test", SimpleCommandMeta.empty()).argument(StringArgument.optional("something"))
|
||||||
.argument(StaticArgument.of("somethingelse")).build());
|
.argument(StaticArgument.of("somethingelse")).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue