chore: make code style consistent
This commit is contained in:
parent
a2cea2f33e
commit
89ec3fbf29
380 changed files with 479 additions and 936 deletions
|
|
@ -88,7 +88,7 @@ ij_java_blank_lines_around_field_in_interface = 0
|
|||
ij_java_blank_lines_around_initializer = 1
|
||||
ij_java_blank_lines_around_method = 1
|
||||
ij_java_blank_lines_around_method_in_interface = 1
|
||||
ij_java_blank_lines_before_class_end = 1
|
||||
ij_java_blank_lines_before_class_end = 0
|
||||
ij_java_blank_lines_before_imports = 1
|
||||
ij_java_blank_lines_before_method_body = 0
|
||||
ij_java_blank_lines_before_package = 0
|
||||
|
|
@ -141,7 +141,7 @@ ij_java_imports_layout = *,|,$*
|
|||
ij_java_indent_case_from_switch = true
|
||||
ij_java_insert_inner_class_imports = false
|
||||
ij_java_insert_override_annotation = true
|
||||
ij_java_keep_blank_lines_before_right_brace = 2
|
||||
ij_java_keep_blank_lines_before_right_brace = 0
|
||||
ij_java_keep_blank_lines_between_package_declaration_and_header = 2
|
||||
ij_java_keep_blank_lines_in_code = 2
|
||||
ij_java_keep_blank_lines_in_declarations = 2
|
||||
|
|
|
|||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -227,3 +227,6 @@ gradle-app.setting
|
|||
|
||||
/run/
|
||||
/cloud-minecraft/cloud-fabric/run/
|
||||
|
||||
# MacOS
|
||||
**/.DS_Store
|
||||
|
|
|
|||
|
|
@ -331,8 +331,8 @@ public final class AnnotationParser<C> {
|
|||
*
|
||||
* @return Collection of parsed commands
|
||||
* @throws Exception re-throws all encountered exceptions.
|
||||
* @since 1.7.0
|
||||
* @see cloud.commandframework.annotations.processing.CommandContainer CommandContainer for more information.
|
||||
* @since 1.7.0
|
||||
*/
|
||||
public @NonNull Collection<@NonNull Command<C>> parseContainers() throws Exception {
|
||||
final List<Command<C>> commands = new LinkedList<>();
|
||||
|
|
@ -635,8 +635,9 @@ public final class AnnotationParser<C> {
|
|||
/* Apply builder modifiers */
|
||||
for (final Annotation annotation
|
||||
: AnnotationAccessor.of(classAnnotations, AnnotationAccessor.of(method)).annotations()) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
final BiFunction builderModifier = this.builderModifiers.get(annotation.annotationType());
|
||||
@SuppressWarnings("rawtypes") final BiFunction builderModifier = this.builderModifiers.get(
|
||||
annotation.annotationType()
|
||||
);
|
||||
if (builderModifier == null) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -774,5 +775,4 @@ public final class AnnotationParser<C> {
|
|||
@NonNull Function<@NonNull ? extends Annotation, @NonNull ParserParameters>> getAnnotationMappers() {
|
||||
return this.annotationMappers;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public @interface Argument {
|
|||
* The name of the argument that this parameter is bound to.
|
||||
* This value must be overridden unless you have explicitly enabled
|
||||
* the preservation of parameter names in your compiler options.
|
||||
*
|
||||
* <p>
|
||||
* If the parameter names are preserved and the name of the bound
|
||||
* argument is the same as the parameter name, the default value
|
||||
* may be used.
|
||||
|
|
@ -86,5 +86,4 @@ public @interface Argument {
|
|||
* @return Argument description
|
||||
*/
|
||||
@NonNull String description() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,5 +47,4 @@ class ArgumentExtractor implements Function<@NonNull Method, @NonNull Collection
|
|||
}
|
||||
return arguments;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,5 +54,4 @@ final class ArgumentParameterPair {
|
|||
return this.argument.value();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,5 +43,4 @@ public @interface CommandDescription {
|
|||
* @return Command syntax
|
||||
*/
|
||||
@NonNull String value() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
public @interface CommandMethod {
|
||||
|
||||
String ANNOTATION_PATH = "cloud.commandframework.annotations.CommandMethod";
|
||||
|
||||
/**
|
||||
|
|
@ -50,5 +51,4 @@ public @interface CommandMethod {
|
|||
* @return Required sender
|
||||
*/
|
||||
@NonNull Class<?> requiredSender() default Object.class;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,5 +46,4 @@ final class CommandMethodPair {
|
|||
@NonNull CommandMethod getCommandMethod() {
|
||||
return this.commandMethod;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,5 +42,4 @@ public @interface CommandPermission {
|
|||
* @return Command permission
|
||||
*/
|
||||
@NonNull String value() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,5 +94,4 @@ public @interface Flag {
|
|||
* @since 1.6.0
|
||||
*/
|
||||
@NonNull String permission() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,5 +116,4 @@ final class FlagExtractor implements Function<@NonNull Method, Collection<@NonNu
|
|||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,5 +55,4 @@ class MetaFactory implements Function<@NonNull Method, @NonNull CommandMeta> {
|
|||
});
|
||||
return this.metaMapper.apply(parameters);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,7 +273,5 @@ public class MethodCommandExecutionHandler<C> implements CommandExecutionHandler
|
|||
public @NonNull AnnotationParser<C> annotationParser() {
|
||||
return this.annotationParser;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,5 +51,4 @@ public @interface ProxiedBy {
|
|||
* @return {@code true} if the proxying command should be hidden, {@code false} if not
|
||||
*/
|
||||
boolean hidden() default false;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,5 +52,4 @@ public @interface Regex {
|
|||
* @return Failure caption key
|
||||
*/
|
||||
@NonNull String failureCaption() default "argument.parse.failure.regex";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,5 +75,4 @@ public final class SyntaxFragment {
|
|||
public @NonNull ArgumentMode getArgumentMode() {
|
||||
return this.argumentMode;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,5 +85,4 @@ public final class MethodArgumentParser<C, T> implements ArgumentParser<C, T> {
|
|||
) {
|
||||
return this.suggestionProvider.apply(commandContext, input);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,5 +66,4 @@ public @interface Parser {
|
|||
* @return The name of the suggestion provider, or {@code ""}
|
||||
*/
|
||||
String suggestions() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,6 @@ import java.lang.annotation.Target;
|
|||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CommandContainer {
|
||||
String ANNOTATION_PATH = "cloud.commandframework.annotations.processing.CommandContainer";
|
||||
|
||||
String ANNOTATION_PATH = "cloud.commandframework.annotations.processing.CommandContainer";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,5 +64,4 @@ public final class MethodSuggestionsProvider<C> implements BiFunction<CommandCon
|
|||
throw new RuntimeException(t);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,5 +48,4 @@ public @interface Suggestions {
|
|||
* @return Suggestions provider name
|
||||
*/
|
||||
@NonNull String value();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,7 +273,6 @@ class AnnotationParserTest {
|
|||
public void annotatedMethod() {
|
||||
System.out.println("kekw");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@CommandPermission("some.permission")
|
||||
|
|
@ -292,7 +291,6 @@ class AnnotationParserTest {
|
|||
@AnnotatedAnnotation
|
||||
public static void annotatedMethod() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -324,7 +322,6 @@ class AnnotationParserTest {
|
|||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -340,7 +337,6 @@ class AnnotationParserTest {
|
|||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -354,7 +350,6 @@ class AnnotationParserTest {
|
|||
* @return Integer argument name
|
||||
*/
|
||||
String value() default "number";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -373,7 +368,5 @@ class AnnotationParserTest {
|
|||
@CommandMethod(COMMAND_ALIASES + " sub2")
|
||||
public void commandThree() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,12 @@ class NoOpStringProcessorTest {
|
|||
for (int i = 0; i < 10; i++) {
|
||||
// Arrange
|
||||
final StringProcessor stringProcessor = StringProcessor.noOp();
|
||||
final String input = ThreadLocalRandom.current().ints().mapToObj(Integer::toString).limit(32).collect(Collectors.joining());
|
||||
final String input = ThreadLocalRandom
|
||||
.current()
|
||||
.ints()
|
||||
.mapToObj(Integer::toString)
|
||||
.limit(32)
|
||||
.collect(Collectors.joining());
|
||||
|
||||
// Act
|
||||
final String output = stringProcessor.processString(input);
|
||||
|
|
|
|||
|
|
@ -46,5 +46,4 @@ public class TestCommandManager extends CommandManager<TestCommandSender> {
|
|||
) {
|
||||
return !permission.equalsIgnoreCase("no");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import cloud.commandframework.meta.CommandMeta;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Collectors;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,9 @@ public class CommandMethodProcessorTest {
|
|||
|
||||
// Assert
|
||||
assertThat(compilation).failed();
|
||||
assertThat(compilation).hadErrorContaining("Required argument 'required' cannot succeed an optional argument (commandMethod)");
|
||||
assertThat(compilation).hadErrorContaining(
|
||||
"Required argument 'required' cannot succeed an optional argument (commandMethod)"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -77,5 +77,4 @@ public interface ArgumentDescription {
|
|||
default boolean isEmpty() {
|
||||
return this.getDescription().isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ public interface CloudCapability {
|
|||
*
|
||||
* @return the name of the capability
|
||||
*/
|
||||
@Override @NonNull String toString();
|
||||
@Override
|
||||
@NonNull String toString();
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -158,8 +158,8 @@ public class Command<C> {
|
|||
* @param senderType Required sender type. May be {@code null}
|
||||
* @param commandPermission Command permission
|
||||
* @param commandMeta Command meta instance
|
||||
* @deprecated Map does not allow for the same literal or variable argument name to repeat
|
||||
* @see #Command(List, CommandExecutionHandler, Class, CommandPermission, CommandMeta)
|
||||
* @deprecated Map does not allow for the same literal or variable argument name to repeat
|
||||
*/
|
||||
@Deprecated
|
||||
@API(status = API.Status.DEPRECATED)
|
||||
|
|
@ -180,8 +180,8 @@ public class Command<C> {
|
|||
* @param commandExecutionHandler Execution handler
|
||||
* @param senderType Required sender type. May be {@code null}
|
||||
* @param commandMeta Command meta instance
|
||||
* @deprecated Map does not allow for the same literal or variable argument name to repeat
|
||||
* @see #Command(List, CommandExecutionHandler, Class, CommandMeta)
|
||||
* @deprecated Map does not allow for the same literal or variable argument name to repeat
|
||||
*/
|
||||
@Deprecated
|
||||
@API(status = API.Status.DEPRECATED)
|
||||
|
|
@ -201,8 +201,8 @@ public class Command<C> {
|
|||
* @param commandExecutionHandler Execution handler
|
||||
* @param commandPermission Command permission
|
||||
* @param commandMeta Command meta instance
|
||||
* @deprecated Map does not allow for the same literal or variable argument name to repeat
|
||||
* @see #Command(List, CommandExecutionHandler, CommandPermission, CommandMeta)
|
||||
* @deprecated Map does not allow for the same literal or variable argument name to repeat
|
||||
*/
|
||||
@Deprecated
|
||||
@API(status = API.Status.DEPRECATED)
|
||||
|
|
@ -1199,7 +1199,5 @@ public class Command<C> {
|
|||
this.commandMeta
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,8 @@ public final class CommandComponent<C> {
|
|||
@Override
|
||||
public @NonNull String toString() {
|
||||
return String.format("%s{argument=%s,description=%s}", this.getClass().getSimpleName(),
|
||||
this.argument, this.description);
|
||||
this.argument, this.description
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -381,7 +381,6 @@ public final class CommandHelpHandler<C> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.command, this.syntaxString, this.description);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -440,7 +439,6 @@ public final class CommandHelpHandler<C> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.entries);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -503,7 +501,6 @@ public final class CommandHelpHandler<C> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.command, this.description);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -568,7 +565,5 @@ public final class CommandHelpHandler<C> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.longestPath, this.childSuggestions);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1210,5 +1210,4 @@ public abstract class CommandManager<C> {
|
|||
*/
|
||||
AFTER_REGISTRATION
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,8 +141,7 @@ public final class CommandTree<C> {
|
|||
new NoSuchCommandException(
|
||||
commandContext.getSender(),
|
||||
new ArrayList<>(),
|
||||
this.stringOrEmpty(args.peek()
|
||||
)
|
||||
this.stringOrEmpty(args.peek())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
@ -849,8 +848,8 @@ public final class CommandTree<C> {
|
|||
}
|
||||
|
||||
// List of child nodes that are static arguments, with fixed values
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
final List<Node<StaticArgument<?>>> childStaticArguments = node.children.stream()
|
||||
@SuppressWarnings({"rawtypes", "unchecked"}) final List<Node<StaticArgument<?>>> childStaticArguments = node.children
|
||||
.stream()
|
||||
.filter(n -> n.getValue() instanceof StaticArgument)
|
||||
.map(n -> (Node<StaticArgument<?>>) ((Node) n))
|
||||
.collect(Collectors.toList());
|
||||
|
|
@ -1091,7 +1090,5 @@ public final class CommandTree<C> {
|
|||
public String toString() {
|
||||
return "Node{value=" + this.value + '}';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,5 +89,4 @@ public final class Description implements ArgumentDescription {
|
|||
public @NonNull String toString() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,5 +73,4 @@ public abstract class LockableCommandManager<C> extends CommandManager<C> {
|
|||
protected final void lockWrites() {
|
||||
this.lockRegistration();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,5 +53,4 @@ final class AnnotatedElementAccessor implements AnnotationAccessor {
|
|||
public @NonNull Collection<@NonNull Annotation> annotations() {
|
||||
return Collections.unmodifiableCollection(Arrays.asList(this.element.getAnnotations()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,5 @@ public interface AnnotationAccessor {
|
|||
public @NonNull Collection<@NonNull Annotation> annotations() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,5 +61,4 @@ final class MultiDelegateAnnotationAccessor implements AnnotationAccessor {
|
|||
}
|
||||
return Collections.unmodifiableCollection(annotationList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,5 +67,4 @@ public final class GuiceInjectionService<C> implements InjectionService<C> {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,5 +51,4 @@ public interface ParameterInjector<C, T> {
|
|||
* by this particular injector
|
||||
*/
|
||||
@Nullable T create(@NonNull CommandContext<C> context, @NonNull AnnotationAccessor annotationAccessor);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,5 +153,4 @@ public final class ParameterInjectorRegistry<C> implements InjectionService<C> {
|
|||
this.servicePipeline.registerServiceImplementation(new TypeToken<InjectionService<C>>() {
|
||||
}, service, Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* Classes related to parameter injection
|
||||
*
|
||||
* <p>
|
||||
* This package will be moved in a future release
|
||||
*/
|
||||
package cloud.commandframework.annotations.injection;
|
||||
|
|
|
|||
|
|
@ -44,5 +44,4 @@ public @interface Completions {
|
|||
* @return Command completions
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,5 +53,4 @@ public @interface Range {
|
|||
* @return String serialized number
|
||||
*/
|
||||
@NonNull String max() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -748,7 +748,6 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
|
|||
protected final @NonNull TypeToken<T> getValueType() {
|
||||
return this.valueType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -837,7 +836,5 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
|
|||
super.withSuggestionsProvider(suggestionsProvider);
|
||||
return this.self();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,5 +48,4 @@ public interface CommandSuggestionEngine<C> {
|
|||
@NonNull CommandContext<C> context,
|
||||
@NonNull String input
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,5 +53,4 @@ public interface CommandSyntaxFormatter<C> {
|
|||
@NonNull List<@NonNull CommandArgument<C, ?>> commandArguments,
|
||||
CommandTree.@Nullable Node<@Nullable CommandArgument<C, ?>> node
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,5 +87,4 @@ public final class DelegatingCommandSuggestionEngine<C> implements CommandSugges
|
|||
}
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,5 +60,4 @@ public final class DelegatingCommandSuggestionEngineFactory<C> {
|
|||
this.commandTree
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,5 +53,4 @@ final class DelegatingSuggestionsProvider<C> implements BiFunction<@NonNull Comm
|
|||
this.parser.getClass().getCanonicalName()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,7 +294,5 @@ public class StandardCommandSyntaxFormatter<C> implements CommandSyntaxFormatter
|
|||
public void appendBlankSpace() {
|
||||
this.builder.append(' ');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,7 +152,5 @@ public final class StaticArgument<C> extends CommandArgument<C, String> {
|
|||
this.allAcceptedAliases.add(alias);
|
||||
this.alternativeAliases.add(alias);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,5 @@ public class ArgumentPair<C, U, V, O> extends CompoundArgument<Pair<U, V>, C, O>
|
|||
) {
|
||||
return this.withMapper(TypeToken.get(clazz), mapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,5 @@ public class ArgumentTriplet<C, U, V, W, O> extends CompoundArgument<Triplet<U,
|
|||
this.parserTriplet, mapper, TypeToken.get(clazz)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,7 +174,5 @@ public class CompoundArgument<T extends Tuple, C, O> extends CommandArgument<C,
|
|||
final int argument = commandContext.getOrDefault("__parsing_argument__", 1) - 1;
|
||||
return ((ArgumentParser<C, ?>) this.parsers[argument]).suggestions(commandContext, input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -299,7 +299,10 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
|
|||
* can be obtained, which are used for providing suggestions.
|
||||
*/
|
||||
private class FlagParser {
|
||||
/** The current flag whose value is being parsed */
|
||||
|
||||
/**
|
||||
* The current flag whose value is being parsed
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private Optional<CommandFlag<?>> currentFlagBeingParsed = Optional.empty();
|
||||
/**
|
||||
|
|
@ -516,7 +519,6 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
|
|||
public String getInput() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -546,7 +548,5 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
|
|||
public @NonNull Caption getCaption() {
|
||||
return this.caption;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,7 +292,5 @@ public final class CommandFlag<T> {
|
|||
public @NonNull CommandFlag<T> build() {
|
||||
return new CommandFlag<>(this.name, this.aliases, this.description, this.permission, this.commandArgument);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -263,5 +263,4 @@ public final class FlagContext {
|
|||
) {
|
||||
return this.getValue(flag).orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,6 @@ public abstract class ArgumentParseResult<T> {
|
|||
public @NonNull @This ArgumentParseResult<T> mapFailure(final Function<Throwable, Throwable> mapper) {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final class ParseFailure<T> extends ArgumentParseResult<T> {
|
||||
|
|
@ -185,5 +184,4 @@ public abstract class ArgumentParseResult<T> {
|
|||
return new ParseFailure<>(mapper.apply(this.failure));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,5 +127,4 @@ public interface ArgumentParser<C, T> {
|
|||
default int getRequestedArgumentCount() {
|
||||
return DEFAULT_ARGUMENT_COUNT;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||
*/
|
||||
@API(status = API.Status.STABLE, since = "1.5.0")
|
||||
public final class MappedArgumentParser<C, I, O> implements ArgumentParser<C, O> {
|
||||
|
||||
private final ArgumentParser<C, I> base;
|
||||
private final BiFunction<CommandContext<C>, I, ArgumentParseResult<O>> mapper;
|
||||
|
||||
|
|
@ -119,5 +120,4 @@ public final class MappedArgumentParser<C, I, O> implements ArgumentParser<C, O>
|
|||
+ "base=" + this.base + ','
|
||||
+ "mapper=" + this.mapper + '}';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,5 +88,4 @@ public class ParserParameter<T> {
|
|||
public final int hashCode() {
|
||||
return Objects.hash(this.key, this.expectedType);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,5 +122,4 @@ public final class ParserParameters {
|
|||
public @NonNull Map<@NonNull ParserParameter<?>, @NonNull Object> getAll() {
|
||||
return Collections.unmodifiableMap(this.internalMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,5 +151,4 @@ public interface ParserRegistry<C> {
|
|||
@NonNull Optional<BiFunction<@NonNull CommandContext<C>, @NonNull String, @NonNull List<String>>> getSuggestionProvider(
|
||||
@NonNull String name
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ public final class StandardParameters {
|
|||
/**
|
||||
* Indicates that an argument should stop parsing when encountering a potential flag.
|
||||
*
|
||||
* @since 1.7.0
|
||||
* @see cloud.commandframework.annotations.specifier.FlagYielding
|
||||
* @since 1.7.0
|
||||
*/
|
||||
@API(status = API.Status.STABLE, since = "1.7.0")
|
||||
public static final ParserParameter<Boolean> FLAG_YIELDING = create(
|
||||
|
|
@ -96,5 +96,4 @@ public final class StandardParameters {
|
|||
) {
|
||||
return new ParserParameter<>(key, expectedType);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,9 +247,9 @@ public final class StandardParserRegistry<C> implements ParserRegistry<C> {
|
|||
if (producer == null) {
|
||||
/* Give enums special treatment */
|
||||
if (GenericTypeReflector.isSuperType(Enum.class, actualType.getType())) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
final EnumArgument.EnumParser enumArgument
|
||||
= new EnumArgument.EnumParser(GenericTypeReflector.erase(actualType.getType()));
|
||||
@SuppressWarnings("rawtypes") final EnumArgument.EnumParser enumArgument = new EnumArgument.EnumParser(
|
||||
GenericTypeReflector.erase(actualType.getType())
|
||||
);
|
||||
return Optional.of(enumArgument);
|
||||
}
|
||||
return Optional.empty();
|
||||
|
|
@ -359,7 +359,6 @@ public final class StandardParserRegistry<C> implements ParserRegistry<C> {
|
|||
}
|
||||
return parserParameters;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -370,7 +369,5 @@ public final class StandardParserRegistry<C> implements ParserRegistry<C> {
|
|||
public @NonNull ParserParameters apply(final @NonNull Greedy greedy, final @NonNull TypeToken<?> typeToken) {
|
||||
return ParserParameters.single(StandardParameters.GREEDY, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,5 @@ public final class RegexPreprocessor<C> implements BiFunction<@NonNull CommandCo
|
|||
public @NonNull String getPattern() {
|
||||
return this.pattern;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,7 +157,6 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
|
|||
this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -243,7 +242,6 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
|
|||
public boolean isContextFree() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -314,7 +312,5 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.input, this.liberal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,6 @@ public final class ByteArgument<C> extends CommandArgument<C, Byte> {
|
|||
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -296,7 +295,6 @@ public final class ByteArgument<C> extends CommandArgument<C, Byte> {
|
|||
public boolean hasMin() {
|
||||
return this.min != DEFAULT_MINIMUM;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -379,7 +377,5 @@ public final class ByteArgument<C> extends CommandArgument<C, Byte> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.parser);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ public final class CharArgument<C> extends CommandArgument<C, Character> {
|
|||
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -154,7 +153,6 @@ public final class CharArgument<C> extends CommandArgument<C, Character> {
|
|||
public boolean isContextFree() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -208,7 +206,5 @@ public final class CharArgument<C> extends CommandArgument<C, Character> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,6 @@ public final class DoubleArgument<C> extends CommandArgument<C, Double> {
|
|||
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -286,7 +285,6 @@ public final class DoubleArgument<C> extends CommandArgument<C, Double> {
|
|||
public boolean hasMin() {
|
||||
return this.min != DEFAULT_MINIMUM;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -365,7 +363,5 @@ public final class DoubleArgument<C> extends CommandArgument<C, Double> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.parser);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,6 @@ public final class DurationArgument<C> extends CommandArgument<C, Duration> {
|
|||
this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -277,7 +276,6 @@ public final class DurationArgument<C> extends CommandArgument<C, Duration> {
|
|||
.map(unit -> input + unit)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -320,7 +318,5 @@ public final class DurationArgument<C> extends CommandArgument<C, Duration> {
|
|||
public @NonNull String getInput() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,6 @@ public class EnumArgument<C, E extends Enum<E>> extends CommandArgument<C, E> {
|
|||
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -202,7 +201,6 @@ public class EnumArgument<C, E extends Enum<E>> extends CommandArgument<C, E> {
|
|||
public boolean isContextFree() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -278,7 +276,5 @@ public class EnumArgument<C, E extends Enum<E>> extends CommandArgument<C, E> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.input, this.enumClass);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,7 +179,6 @@ public final class FloatArgument<C> extends CommandArgument<C, Float> {
|
|||
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -283,7 +282,6 @@ public final class FloatArgument<C> extends CommandArgument<C, Float> {
|
|||
public boolean hasMin() {
|
||||
return this.min != DEFAULT_MINIMUM;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -364,7 +362,5 @@ public final class FloatArgument<C> extends CommandArgument<C, Float> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.parser);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,6 @@ public final class IntegerArgument<C> extends CommandArgument<C, Integer> {
|
|||
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -344,7 +343,6 @@ public final class IntegerArgument<C> extends CommandArgument<C, Integer> {
|
|||
) {
|
||||
return getSuggestions(this.min, this.max, input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -425,7 +423,5 @@ public final class IntegerArgument<C> extends CommandArgument<C, Integer> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.parser);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,7 +179,6 @@ public final class LongArgument<C> extends CommandArgument<C, Long> {
|
|||
this.max, this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -291,7 +290,6 @@ public final class LongArgument<C> extends CommandArgument<C, Long> {
|
|||
) {
|
||||
return IntegerArgument.IntegerParser.getSuggestions(this.min, this.max, input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -372,7 +370,5 @@ public final class LongArgument<C> extends CommandArgument<C, Long> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.parser);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,7 +176,6 @@ public final class ShortArgument<C> extends CommandArgument<C, Short> {
|
|||
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -288,7 +287,6 @@ public final class ShortArgument<C> extends CommandArgument<C, Short> {
|
|||
public boolean hasMin() {
|
||||
return this.min != DEFAULT_MINIMUM;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -369,7 +367,5 @@ public final class ShortArgument<C> extends CommandArgument<C, Short> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.parser);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -306,7 +306,6 @@ public final class StringArgument<C> extends CommandArgument<C, String> {
|
|||
this.getDefaultValue(), this.suggestionsProvider, this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -465,7 +464,6 @@ public final class StringArgument<C> extends CommandArgument<C, String> {
|
|||
public @NonNull StringMode getStringMode() {
|
||||
return this.stringMode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -517,7 +515,5 @@ public final class StringArgument<C> extends CommandArgument<C, String> {
|
|||
public @NonNull StringMode getStringMode() {
|
||||
return this.stringMode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,7 +217,5 @@ public final class StringArrayArgument<C> extends CommandArgument<C, String[]> {
|
|||
return ArgumentParseResult.success(result);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ public final class UUIDArgument<C> extends CommandArgument<C, UUID> {
|
|||
this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -160,7 +159,6 @@ public final class UUIDArgument<C> extends CommandArgument<C, UUID> {
|
|||
public boolean isContextFree() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -214,7 +212,5 @@ public final class UUIDArgument<C> extends CommandArgument<C, UUID> {
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,5 +82,4 @@ public final class Caption {
|
|||
this.key
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,5 +42,4 @@ public interface CaptionRegistry<C> {
|
|||
* @return Caption
|
||||
*/
|
||||
@NonNull String getCaption(@NonNull Caption caption, @NonNull C sender);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,5 +68,4 @@ public final class CaptionVariable {
|
|||
public @NonNull String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,4 @@ public interface CaptionVariableReplacementHandler {
|
|||
* @return Transformed message
|
||||
*/
|
||||
@NonNull String replaceVariables(@NonNull String string, @NonNull CaptionVariable... variables);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,5 +45,4 @@ public interface FactoryDelegatingCaptionRegistry<C> extends CaptionRegistry<C>
|
|||
@NonNull Caption caption,
|
||||
@NonNull BiFunction<Caption, C, String> factory
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,5 +187,4 @@ public class SimpleCaptionRegistry<C> implements FactoryDelegatingCaptionRegistr
|
|||
) {
|
||||
this.messageFactories.put(caption, messageFactory);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,5 +42,4 @@ public final class SimpleCaptionRegistryFactory<C> {
|
|||
public @NonNull SimpleCaptionRegistry<C> create() {
|
||||
return new SimpleCaptionRegistry<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,5 +43,4 @@ public final class SimpleCaptionVariableReplacementHandler implements CaptionVar
|
|||
}
|
||||
return replacedString;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,5 +115,4 @@ public final class StandardCaptionKeys {
|
|||
public static @NonNull Collection<@NonNull Caption> getStandardCaptionKeys() {
|
||||
return Collections.unmodifiableCollection(RECOGNIZED_CAPTIONS);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -740,7 +740,5 @@ public class CommandContext<C> {
|
|||
public boolean wasSuccess() {
|
||||
return this.success;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,5 +68,4 @@ public interface CommandContextFactory<C> {
|
|||
@NonNull C sender,
|
||||
@NonNull CommandManager<C> commandManager
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,5 +57,4 @@ public final class StandardCommandContextFactory<C> implements CommandContextFac
|
|||
commandManager
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,5 +108,4 @@ public final class AmbiguousNodeException extends IllegalStateException {
|
|||
return stringBuilder.append(")")
|
||||
.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,5 +60,4 @@ public class ArgumentParseException extends CommandParseException {
|
|||
public synchronized @NonNull Throwable getCause() {
|
||||
return this.cause;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,5 +73,4 @@ public class CommandExecutionException extends IllegalArgumentException {
|
|||
public @Nullable CommandContext<?> getCommandContext() {
|
||||
return this.commandContext;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,5 +72,4 @@ public class CommandParseException extends IllegalArgumentException {
|
|||
public @NonNull List<@NonNull CommandArgument<?, ?>> getCurrentChain() {
|
||||
return Collections.unmodifiableList(this.currentChain);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,5 +106,4 @@ public final class InvalidCommandSenderException extends CommandParseException {
|
|||
public @Nullable Command<?> getCommand() {
|
||||
return this.command;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,5 +69,4 @@ public class InvalidSyntaxException extends CommandParseException {
|
|||
public final String getMessage() {
|
||||
return String.format("Invalid command syntax. Correct syntax is: %s", this.correctSyntax);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,5 +58,4 @@ public final class NoCommandInLeafException extends IllegalStateException {
|
|||
public @NonNull CommandArgument<?, ?> getCommandArgument() {
|
||||
return this.commandArgument;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue