chore: make code style consistent

This commit is contained in:
Citymonstret 2022-06-10 10:24:50 +02:00 committed by Jason
parent a2cea2f33e
commit 89ec3fbf29
380 changed files with 479 additions and 936 deletions

View file

@ -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_initializer = 1
ij_java_blank_lines_around_method = 1 ij_java_blank_lines_around_method = 1
ij_java_blank_lines_around_method_in_interface = 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_imports = 1
ij_java_blank_lines_before_method_body = 0 ij_java_blank_lines_before_method_body = 0
ij_java_blank_lines_before_package = 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_indent_case_from_switch = true
ij_java_insert_inner_class_imports = false ij_java_insert_inner_class_imports = false
ij_java_insert_override_annotation = true 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_between_package_declaration_and_header = 2
ij_java_keep_blank_lines_in_code = 2 ij_java_keep_blank_lines_in_code = 2
ij_java_keep_blank_lines_in_declarations = 2 ij_java_keep_blank_lines_in_declarations = 2

3
.gitignore vendored
View file

@ -227,3 +227,6 @@ gradle-app.setting
/run/ /run/
/cloud-minecraft/cloud-fabric/run/ /cloud-minecraft/cloud-fabric/run/
# MacOS
**/.DS_Store

View file

@ -331,8 +331,8 @@ public final class AnnotationParser<C> {
* *
* @return Collection of parsed commands * @return Collection of parsed commands
* @throws Exception re-throws all encountered exceptions. * @throws Exception re-throws all encountered exceptions.
* @since 1.7.0
* @see cloud.commandframework.annotations.processing.CommandContainer CommandContainer for more information. * @see cloud.commandframework.annotations.processing.CommandContainer CommandContainer for more information.
* @since 1.7.0
*/ */
public @NonNull Collection<@NonNull Command<C>> parseContainers() throws Exception { public @NonNull Collection<@NonNull Command<C>> parseContainers() throws Exception {
final List<Command<C>> commands = new LinkedList<>(); final List<Command<C>> commands = new LinkedList<>();
@ -635,8 +635,9 @@ public final class AnnotationParser<C> {
/* Apply builder modifiers */ /* Apply builder modifiers */
for (final Annotation annotation for (final Annotation annotation
: AnnotationAccessor.of(classAnnotations, AnnotationAccessor.of(method)).annotations()) { : AnnotationAccessor.of(classAnnotations, AnnotationAccessor.of(method)).annotations()) {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes") final BiFunction builderModifier = this.builderModifiers.get(
final BiFunction builderModifier = this.builderModifiers.get(annotation.annotationType()); annotation.annotationType()
);
if (builderModifier == null) { if (builderModifier == null) {
continue; continue;
} }
@ -774,5 +775,4 @@ public final class AnnotationParser<C> {
@NonNull Function<@NonNull ? extends Annotation, @NonNull ParserParameters>> getAnnotationMappers() { @NonNull Function<@NonNull ? extends Annotation, @NonNull ParserParameters>> getAnnotationMappers() {
return this.annotationMappers; return this.annotationMappers;
} }
} }

View file

@ -41,7 +41,7 @@ public @interface Argument {
* The name of the argument that this parameter is bound to. * The name of the argument that this parameter is bound to.
* This value must be overridden unless you have explicitly enabled * This value must be overridden unless you have explicitly enabled
* the preservation of parameter names in your compiler options. * the preservation of parameter names in your compiler options.
* * <p>
* If the parameter names are preserved and the name of the bound * If the parameter names are preserved and the name of the bound
* argument is the same as the parameter name, the default value * argument is the same as the parameter name, the default value
* may be used. * may be used.
@ -86,5 +86,4 @@ public @interface Argument {
* @return Argument description * @return Argument description
*/ */
@NonNull String description() default ""; @NonNull String description() default "";
} }

View file

@ -47,5 +47,4 @@ class ArgumentExtractor implements Function<@NonNull Method, @NonNull Collection
} }
return arguments; return arguments;
} }
} }

View file

@ -54,5 +54,4 @@ final class ArgumentParameterPair {
return this.argument.value(); return this.argument.value();
} }
} }
} }

View file

@ -43,5 +43,4 @@ public @interface CommandDescription {
* @return Command syntax * @return Command syntax
*/ */
@NonNull String value() default ""; @NonNull String value() default "";
} }

View file

@ -35,6 +35,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE}) @Target({ElementType.METHOD, ElementType.TYPE})
public @interface CommandMethod { public @interface CommandMethod {
String ANNOTATION_PATH = "cloud.commandframework.annotations.CommandMethod"; String ANNOTATION_PATH = "cloud.commandframework.annotations.CommandMethod";
/** /**
@ -50,5 +51,4 @@ public @interface CommandMethod {
* @return Required sender * @return Required sender
*/ */
@NonNull Class<?> requiredSender() default Object.class; @NonNull Class<?> requiredSender() default Object.class;
} }

View file

@ -46,5 +46,4 @@ final class CommandMethodPair {
@NonNull CommandMethod getCommandMethod() { @NonNull CommandMethod getCommandMethod() {
return this.commandMethod; return this.commandMethod;
} }
} }

View file

@ -42,5 +42,4 @@ public @interface CommandPermission {
* @return Command permission * @return Command permission
*/ */
@NonNull String value() default ""; @NonNull String value() default "";
} }

View file

@ -94,5 +94,4 @@ public @interface Flag {
* @since 1.6.0 * @since 1.6.0
*/ */
@NonNull String permission() default ""; @NonNull String permission() default "";
} }

View file

@ -116,5 +116,4 @@ final class FlagExtractor implements Function<@NonNull Method, Collection<@NonNu
} }
return flags; return flags;
} }
} }

View file

@ -55,5 +55,4 @@ class MetaFactory implements Function<@NonNull Method, @NonNull CommandMeta> {
}); });
return this.metaMapper.apply(parameters); return this.metaMapper.apply(parameters);
} }
} }

View file

@ -273,7 +273,5 @@ public class MethodCommandExecutionHandler<C> implements CommandExecutionHandler
public @NonNull AnnotationParser<C> annotationParser() { public @NonNull AnnotationParser<C> annotationParser() {
return this.annotationParser; return this.annotationParser;
} }
} }
} }

View file

@ -51,5 +51,4 @@ public @interface ProxiedBy {
* @return {@code true} if the proxying command should be hidden, {@code false} if not * @return {@code true} if the proxying command should be hidden, {@code false} if not
*/ */
boolean hidden() default false; boolean hidden() default false;
} }

View file

@ -52,5 +52,4 @@ public @interface Regex {
* @return Failure caption key * @return Failure caption key
*/ */
@NonNull String failureCaption() default "argument.parse.failure.regex"; @NonNull String failureCaption() default "argument.parse.failure.regex";
} }

View file

@ -75,5 +75,4 @@ public final class SyntaxFragment {
public @NonNull ArgumentMode getArgumentMode() { public @NonNull ArgumentMode getArgumentMode() {
return this.argumentMode; return this.argumentMode;
} }
} }

View file

@ -85,5 +85,4 @@ public final class MethodArgumentParser<C, T> implements ArgumentParser<C, T> {
) { ) {
return this.suggestionProvider.apply(commandContext, input); return this.suggestionProvider.apply(commandContext, input);
} }
} }

View file

@ -66,5 +66,4 @@ public @interface Parser {
* @return The name of the suggestion provider, or {@code ""} * @return The name of the suggestion provider, or {@code ""}
*/ */
String suggestions() default ""; String suggestions() default "";
} }

View file

@ -51,6 +51,6 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface CommandContainer { public @interface CommandContainer {
String ANNOTATION_PATH = "cloud.commandframework.annotations.processing.CommandContainer";
String ANNOTATION_PATH = "cloud.commandframework.annotations.processing.CommandContainer";
} }

View file

@ -64,5 +64,4 @@ public final class MethodSuggestionsProvider<C> implements BiFunction<CommandCon
throw new RuntimeException(t); throw new RuntimeException(t);
} }
} }
} }

View file

@ -48,5 +48,4 @@ public @interface Suggestions {
* @return Suggestions provider name * @return Suggestions provider name
*/ */
@NonNull String value(); @NonNull String value();
} }

View file

@ -273,7 +273,6 @@ class AnnotationParserTest {
public void annotatedMethod() { public void annotatedMethod() {
System.out.println("kekw"); System.out.println("kekw");
} }
} }
@CommandPermission("some.permission") @CommandPermission("some.permission")
@ -292,7 +291,6 @@ class AnnotationParserTest {
@AnnotatedAnnotation @AnnotatedAnnotation
public static void annotatedMethod() { public static void annotatedMethod() {
} }
} }
@ -324,7 +322,6 @@ class AnnotationParserTest {
public String toString() { public String toString() {
return this.value; return this.value;
} }
} }
@ -340,7 +337,6 @@ class AnnotationParserTest {
public String toString() { public String toString() {
return this.value; return this.value;
} }
} }
@ -354,7 +350,6 @@ class AnnotationParserTest {
* @return Integer argument name * @return Integer argument name
*/ */
String value() default "number"; String value() default "number";
} }
@ -373,7 +368,5 @@ class AnnotationParserTest {
@CommandMethod(COMMAND_ALIASES + " sub2") @CommandMethod(COMMAND_ALIASES + " sub2")
public void commandThree() { public void commandThree() {
} }
} }
} }

View file

@ -37,7 +37,12 @@ class NoOpStringProcessorTest {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
// Arrange // Arrange
final StringProcessor stringProcessor = StringProcessor.noOp(); 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 // Act
final String output = stringProcessor.processString(input); final String output = stringProcessor.processString(input);

View file

@ -46,5 +46,4 @@ public class TestCommandManager extends CommandManager<TestCommandSender> {
) { ) {
return !permission.equalsIgnoreCase("no"); return !permission.equalsIgnoreCase("no");
} }
} }

View file

@ -41,7 +41,6 @@ import cloud.commandframework.meta.CommandMeta;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;

View file

@ -74,7 +74,9 @@ public class CommandMethodProcessorTest {
// Assert // Assert
assertThat(compilation).failed(); 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 @Test

View file

@ -77,5 +77,4 @@ public interface ArgumentDescription {
default boolean isEmpty() { default boolean isEmpty() {
return this.getDescription().isEmpty(); return this.getDescription().isEmpty();
} }
} }

View file

@ -39,7 +39,8 @@ public interface CloudCapability {
* *
* @return the name of the capability * @return the name of the capability
*/ */
@Override @NonNull String toString(); @Override
@NonNull String toString();
/** /**

View file

@ -158,8 +158,8 @@ public class Command<C> {
* @param senderType Required sender type. May be {@code null} * @param senderType Required sender type. May be {@code null}
* @param commandPermission Command permission * @param commandPermission Command permission
* @param commandMeta Command meta instance * @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) * @see #Command(List, CommandExecutionHandler, Class, CommandPermission, CommandMeta)
* @deprecated Map does not allow for the same literal or variable argument name to repeat
*/ */
@Deprecated @Deprecated
@API(status = API.Status.DEPRECATED) @API(status = API.Status.DEPRECATED)
@ -180,8 +180,8 @@ public class Command<C> {
* @param commandExecutionHandler Execution handler * @param commandExecutionHandler Execution handler
* @param senderType Required sender type. May be {@code null} * @param senderType Required sender type. May be {@code null}
* @param commandMeta Command meta instance * @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) * @see #Command(List, CommandExecutionHandler, Class, CommandMeta)
* @deprecated Map does not allow for the same literal or variable argument name to repeat
*/ */
@Deprecated @Deprecated
@API(status = API.Status.DEPRECATED) @API(status = API.Status.DEPRECATED)
@ -201,8 +201,8 @@ public class Command<C> {
* @param commandExecutionHandler Execution handler * @param commandExecutionHandler Execution handler
* @param commandPermission Command permission * @param commandPermission Command permission
* @param commandMeta Command meta instance * @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) * @see #Command(List, CommandExecutionHandler, CommandPermission, CommandMeta)
* @deprecated Map does not allow for the same literal or variable argument name to repeat
*/ */
@Deprecated @Deprecated
@API(status = API.Status.DEPRECATED) @API(status = API.Status.DEPRECATED)
@ -1199,7 +1199,5 @@ public class Command<C> {
this.commandMeta this.commandMeta
); );
} }
} }
} }

View file

@ -111,7 +111,8 @@ public final class CommandComponent<C> {
@Override @Override
public @NonNull String toString() { public @NonNull String toString() {
return String.format("%s{argument=%s,description=%s}", this.getClass().getSimpleName(), return String.format("%s{argument=%s,description=%s}", this.getClass().getSimpleName(),
this.argument, this.description); this.argument, this.description
);
} }
/** /**

View file

@ -381,7 +381,6 @@ public final class CommandHelpHandler<C> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.command, this.syntaxString, this.description); return Objects.hash(this.command, this.syntaxString, this.description);
} }
} }
@ -440,7 +439,6 @@ public final class CommandHelpHandler<C> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.entries); return Objects.hash(this.entries);
} }
} }
@ -483,7 +481,7 @@ public final class CommandHelpHandler<C> {
public String toString() { public String toString() {
return "VerboseHelpTopic{" return "VerboseHelpTopic{"
+ "command=" + this.command + "command=" + this.command
+ ", description='" +this.description + '\'' + ", description='" + this.description + '\''
+ '}'; + '}';
} }
@ -503,7 +501,6 @@ public final class CommandHelpHandler<C> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.command, this.description); return Objects.hash(this.command, this.description);
} }
} }
@ -568,7 +565,5 @@ public final class CommandHelpHandler<C> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.longestPath, this.childSuggestions); return Objects.hash(this.longestPath, this.childSuggestions);
} }
} }
} }

View file

@ -1210,5 +1210,4 @@ public abstract class CommandManager<C> {
*/ */
AFTER_REGISTRATION AFTER_REGISTRATION
} }
} }

View file

@ -141,8 +141,7 @@ public final class CommandTree<C> {
new NoSuchCommandException( new NoSuchCommandException(
commandContext.getSender(), commandContext.getSender(),
new ArrayList<>(), 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 // List of child nodes that are static arguments, with fixed values
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({"rawtypes", "unchecked"}) final List<Node<StaticArgument<?>>> childStaticArguments = node.children
final List<Node<StaticArgument<?>>> childStaticArguments = node.children.stream() .stream()
.filter(n -> n.getValue() instanceof StaticArgument) .filter(n -> n.getValue() instanceof StaticArgument)
.map(n -> (Node<StaticArgument<?>>) ((Node) n)) .map(n -> (Node<StaticArgument<?>>) ((Node) n))
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -1091,7 +1090,5 @@ public final class CommandTree<C> {
public String toString() { public String toString() {
return "Node{value=" + this.value + '}'; return "Node{value=" + this.value + '}';
} }
} }
} }

View file

@ -89,5 +89,4 @@ public final class Description implements ArgumentDescription {
public @NonNull String toString() { public @NonNull String toString() {
return this.description; return this.description;
} }
} }

View file

@ -73,5 +73,4 @@ public abstract class LockableCommandManager<C> extends CommandManager<C> {
protected final void lockWrites() { protected final void lockWrites() {
this.lockRegistration(); this.lockRegistration();
} }
} }

View file

@ -53,5 +53,4 @@ final class AnnotatedElementAccessor implements AnnotationAccessor {
public @NonNull Collection<@NonNull Annotation> annotations() { public @NonNull Collection<@NonNull Annotation> annotations() {
return Collections.unmodifiableCollection(Arrays.asList(this.element.getAnnotations())); return Collections.unmodifiableCollection(Arrays.asList(this.element.getAnnotations()));
} }
} }

View file

@ -71,7 +71,7 @@ public interface AnnotationAccessor {
* @since 1.4.0 * @since 1.4.0
*/ */
@API(status = API.Status.STABLE, since = "1.4.0") @API(status = API.Status.STABLE, since = "1.4.0")
static @NonNull AnnotationAccessor of(final @NonNull AnnotationAccessor@NonNull... accessors) { static @NonNull AnnotationAccessor of(final @NonNull AnnotationAccessor @NonNull... accessors) {
return new MultiDelegateAnnotationAccessor(accessors); return new MultiDelegateAnnotationAccessor(accessors);
} }
@ -111,7 +111,5 @@ public interface AnnotationAccessor {
public @NonNull Collection<@NonNull Annotation> annotations() { public @NonNull Collection<@NonNull Annotation> annotations() {
return Collections.emptyList(); return Collections.emptyList();
} }
} }
} }

View file

@ -37,7 +37,7 @@ final class MultiDelegateAnnotationAccessor implements AnnotationAccessor {
private final AnnotationAccessor[] accessors; private final AnnotationAccessor[] accessors;
MultiDelegateAnnotationAccessor(final @NonNull AnnotationAccessor@NonNull... accessors) { MultiDelegateAnnotationAccessor(final @NonNull AnnotationAccessor @NonNull... accessors) {
this.accessors = accessors; this.accessors = accessors;
} }
@ -61,5 +61,4 @@ final class MultiDelegateAnnotationAccessor implements AnnotationAccessor {
} }
return Collections.unmodifiableCollection(annotationList); return Collections.unmodifiableCollection(annotationList);
} }
} }

View file

@ -67,5 +67,4 @@ public final class GuiceInjectionService<C> implements InjectionService<C> {
} }
return null; return null;
} }
} }

View file

@ -51,5 +51,4 @@ public interface ParameterInjector<C, T> {
* by this particular injector * by this particular injector
*/ */
@Nullable T create(@NonNull CommandContext<C> context, @NonNull AnnotationAccessor annotationAccessor); @Nullable T create(@NonNull CommandContext<C> context, @NonNull AnnotationAccessor annotationAccessor);
} }

View file

@ -153,5 +153,4 @@ public final class ParameterInjectorRegistry<C> implements InjectionService<C> {
this.servicePipeline.registerServiceImplementation(new TypeToken<InjectionService<C>>() { this.servicePipeline.registerServiceImplementation(new TypeToken<InjectionService<C>>() {
}, service, Collections.emptyList()); }, service, Collections.emptyList());
} }
} }

View file

@ -1,6 +1,6 @@
/** /**
* Classes related to parameter injection * Classes related to parameter injection
* * <p>
* This package will be moved in a future release * This package will be moved in a future release
*/ */
package cloud.commandframework.annotations.injection; package cloud.commandframework.annotations.injection;

View file

@ -44,5 +44,4 @@ public @interface Completions {
* @return Command completions * @return Command completions
*/ */
String value() default ""; String value() default "";
} }

View file

@ -53,5 +53,4 @@ public @interface Range {
* @return String serialized number * @return String serialized number
*/ */
@NonNull String max() default ""; @NonNull String max() default "";
} }

View file

@ -748,7 +748,6 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
protected final @NonNull TypeToken<T> getValueType() { protected final @NonNull TypeToken<T> getValueType() {
return this.valueType; return this.valueType;
} }
} }
/** /**
@ -837,7 +836,5 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
super.withSuggestionsProvider(suggestionsProvider); super.withSuggestionsProvider(suggestionsProvider);
return this.self(); return this.self();
} }
} }
} }

View file

@ -48,5 +48,4 @@ public interface CommandSuggestionEngine<C> {
@NonNull CommandContext<C> context, @NonNull CommandContext<C> context,
@NonNull String input @NonNull String input
); );
} }

View file

@ -53,5 +53,4 @@ public interface CommandSyntaxFormatter<C> {
@NonNull List<@NonNull CommandArgument<C, ?>> commandArguments, @NonNull List<@NonNull CommandArgument<C, ?>> commandArguments,
CommandTree.@Nullable Node<@Nullable CommandArgument<C, ?>> node CommandTree.@Nullable Node<@Nullable CommandArgument<C, ?>> node
); );
} }

View file

@ -87,5 +87,4 @@ public final class DelegatingCommandSuggestionEngine<C> implements CommandSugges
} }
return suggestions; return suggestions;
} }
} }

View file

@ -60,5 +60,4 @@ public final class DelegatingCommandSuggestionEngineFactory<C> {
this.commandTree this.commandTree
); );
} }
} }

View file

@ -53,5 +53,4 @@ final class DelegatingSuggestionsProvider<C> implements BiFunction<@NonNull Comm
this.parser.getClass().getCanonicalName() this.parser.getClass().getCanonicalName()
); );
} }
} }

View file

@ -294,7 +294,5 @@ public class StandardCommandSyntaxFormatter<C> implements CommandSyntaxFormatter
public void appendBlankSpace() { public void appendBlankSpace() {
this.builder.append(' '); this.builder.append(' ');
} }
} }
} }

View file

@ -152,7 +152,5 @@ public final class StaticArgument<C> extends CommandArgument<C, String> {
this.allAcceptedAliases.add(alias); this.allAcceptedAliases.add(alias);
this.alternativeAliases.add(alias); this.alternativeAliases.add(alias);
} }
} }
} }

View file

@ -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); return this.withMapper(TypeToken.get(clazz), mapper);
} }
} }
} }

View file

@ -200,7 +200,5 @@ public class ArgumentTriplet<C, U, V, W, O> extends CompoundArgument<Triplet<U,
this.parserTriplet, mapper, TypeToken.get(clazz) this.parserTriplet, mapper, TypeToken.get(clazz)
); );
} }
} }
} }

View file

@ -174,7 +174,5 @@ public class CompoundArgument<T extends Tuple, C, O> extends CommandArgument<C,
final int argument = commandContext.getOrDefault("__parsing_argument__", 1) - 1; final int argument = commandContext.getOrDefault("__parsing_argument__", 1) - 1;
return ((ArgumentParser<C, ?>) this.parsers[argument]).suggestions(commandContext, input); return ((ArgumentParser<C, ?>) this.parsers[argument]).suggestions(commandContext, input);
} }
} }
} }

View file

@ -299,7 +299,10 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
* can be obtained, which are used for providing suggestions. * can be obtained, which are used for providing suggestions.
*/ */
private class FlagParser { private class FlagParser {
/** The current flag whose value is being parsed */
/**
* The current flag whose value is being parsed
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
private Optional<CommandFlag<?>> currentFlagBeingParsed = Optional.empty(); private Optional<CommandFlag<?>> currentFlagBeingParsed = Optional.empty();
/** /**
@ -516,7 +519,6 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
public String getInput() { public String getInput() {
return this.input; return this.input;
} }
} }
@ -546,7 +548,5 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
public @NonNull Caption getCaption() { public @NonNull Caption getCaption() {
return this.caption; return this.caption;
} }
} }
} }

View file

@ -292,7 +292,5 @@ public final class CommandFlag<T> {
public @NonNull CommandFlag<T> build() { public @NonNull CommandFlag<T> build() {
return new CommandFlag<>(this.name, this.aliases, this.description, this.permission, this.commandArgument); return new CommandFlag<>(this.name, this.aliases, this.description, this.permission, this.commandArgument);
} }
} }
} }

View file

@ -263,5 +263,4 @@ public final class FlagContext {
) { ) {
return this.getValue(flag).orElse(null); return this.getValue(flag).orElse(null);
} }
} }

View file

@ -144,7 +144,6 @@ public abstract class ArgumentParseResult<T> {
public @NonNull @This ArgumentParseResult<T> mapFailure(final Function<Throwable, Throwable> mapper) { public @NonNull @This ArgumentParseResult<T> mapFailure(final Function<Throwable, Throwable> mapper) {
return this; return this;
} }
} }
private static final class ParseFailure<T> extends ArgumentParseResult<T> { 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)); return new ParseFailure<>(mapper.apply(this.failure));
} }
} }
} }

View file

@ -127,5 +127,4 @@ public interface ArgumentParser<C, T> {
default int getRequestedArgumentCount() { default int getRequestedArgumentCount() {
return DEFAULT_ARGUMENT_COUNT; return DEFAULT_ARGUMENT_COUNT;
} }
} }

View file

@ -41,6 +41,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
*/ */
@API(status = API.Status.STABLE, since = "1.5.0") @API(status = API.Status.STABLE, since = "1.5.0")
public final class MappedArgumentParser<C, I, O> implements ArgumentParser<C, O> { public final class MappedArgumentParser<C, I, O> implements ArgumentParser<C, O> {
private final ArgumentParser<C, I> base; private final ArgumentParser<C, I> base;
private final BiFunction<CommandContext<C>, I, ArgumentParseResult<O>> mapper; 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 + ',' + "base=" + this.base + ','
+ "mapper=" + this.mapper + '}'; + "mapper=" + this.mapper + '}';
} }
} }

View file

@ -88,5 +88,4 @@ public class ParserParameter<T> {
public final int hashCode() { public final int hashCode() {
return Objects.hash(this.key, this.expectedType); return Objects.hash(this.key, this.expectedType);
} }
} }

View file

@ -122,5 +122,4 @@ public final class ParserParameters {
public @NonNull Map<@NonNull ParserParameter<?>, @NonNull Object> getAll() { public @NonNull Map<@NonNull ParserParameter<?>, @NonNull Object> getAll() {
return Collections.unmodifiableMap(this.internalMap); return Collections.unmodifiableMap(this.internalMap);
} }
} }

View file

@ -151,5 +151,4 @@ public interface ParserRegistry<C> {
@NonNull Optional<BiFunction<@NonNull CommandContext<C>, @NonNull String, @NonNull List<String>>> getSuggestionProvider( @NonNull Optional<BiFunction<@NonNull CommandContext<C>, @NonNull String, @NonNull List<String>>> getSuggestionProvider(
@NonNull String name @NonNull String name
); );
} }

View file

@ -64,8 +64,8 @@ public final class StandardParameters {
/** /**
* Indicates that an argument should stop parsing when encountering a potential flag. * Indicates that an argument should stop parsing when encountering a potential flag.
* *
* @since 1.7.0
* @see cloud.commandframework.annotations.specifier.FlagYielding * @see cloud.commandframework.annotations.specifier.FlagYielding
* @since 1.7.0
*/ */
@API(status = API.Status.STABLE, since = "1.7.0") @API(status = API.Status.STABLE, since = "1.7.0")
public static final ParserParameter<Boolean> FLAG_YIELDING = create( public static final ParserParameter<Boolean> FLAG_YIELDING = create(
@ -96,5 +96,4 @@ public final class StandardParameters {
) { ) {
return new ParserParameter<>(key, expectedType); return new ParserParameter<>(key, expectedType);
} }
} }

View file

@ -247,9 +247,9 @@ public final class StandardParserRegistry<C> implements ParserRegistry<C> {
if (producer == null) { if (producer == null) {
/* Give enums special treatment */ /* Give enums special treatment */
if (GenericTypeReflector.isSuperType(Enum.class, actualType.getType())) { if (GenericTypeReflector.isSuperType(Enum.class, actualType.getType())) {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes") final EnumArgument.EnumParser enumArgument = new EnumArgument.EnumParser(
final EnumArgument.EnumParser enumArgument GenericTypeReflector.erase(actualType.getType())
= new EnumArgument.EnumParser(GenericTypeReflector.erase(actualType.getType())); );
return Optional.of(enumArgument); return Optional.of(enumArgument);
} }
return Optional.empty(); return Optional.empty();
@ -359,7 +359,6 @@ public final class StandardParserRegistry<C> implements ParserRegistry<C> {
} }
return parserParameters; 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) { public @NonNull ParserParameters apply(final @NonNull Greedy greedy, final @NonNull TypeToken<?> typeToken) {
return ParserParameters.single(StandardParameters.GREEDY, true); return ParserParameters.single(StandardParameters.GREEDY, true);
} }
} }
} }

View file

@ -168,7 +168,5 @@ public final class RegexPreprocessor<C> implements BiFunction<@NonNull CommandCo
public @NonNull String getPattern() { public @NonNull String getPattern() {
return this.pattern; return this.pattern;
} }
} }
} }

View file

@ -157,7 +157,6 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
this.getDefaultDescription() this.getDefaultDescription()
); );
} }
} }
@ -243,7 +242,6 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
public boolean isContextFree() { public boolean isContextFree() {
return true; return true;
} }
} }
@ -314,7 +312,5 @@ public final class BooleanArgument<C> extends CommandArgument<C, Boolean> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.input, this.liberal); return Objects.hash(this.input, this.liberal);
} }
} }
} }

View file

@ -184,7 +184,6 @@ public final class ByteArgument<C> extends CommandArgument<C, Byte> {
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription() this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }
} }
@ -296,7 +295,6 @@ public final class ByteArgument<C> extends CommandArgument<C, Byte> {
public boolean hasMin() { public boolean hasMin() {
return this.min != DEFAULT_MINIMUM; return this.min != DEFAULT_MINIMUM;
} }
} }
@ -379,7 +377,5 @@ public final class ByteArgument<C> extends CommandArgument<C, Byte> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.parser); return Objects.hash(this.parser);
} }
} }
} }

View file

@ -122,7 +122,6 @@ public final class CharArgument<C> extends CommandArgument<C, Character> {
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription() this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }
} }
@ -154,7 +153,6 @@ public final class CharArgument<C> extends CommandArgument<C, Character> {
public boolean isContextFree() { public boolean isContextFree() {
return true; return true;
} }
} }
@ -208,7 +206,5 @@ public final class CharArgument<C> extends CommandArgument<C, Character> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.input); return Objects.hash(this.input);
} }
} }
} }

View file

@ -184,7 +184,6 @@ public final class DoubleArgument<C> extends CommandArgument<C, Double> {
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription() this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }
} }
@ -286,7 +285,6 @@ public final class DoubleArgument<C> extends CommandArgument<C, Double> {
public boolean hasMin() { public boolean hasMin() {
return this.min != DEFAULT_MINIMUM; return this.min != DEFAULT_MINIMUM;
} }
} }
@ -365,7 +363,5 @@ public final class DoubleArgument<C> extends CommandArgument<C, Double> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.parser); return Objects.hash(this.parser);
} }
} }
} }

View file

@ -190,7 +190,6 @@ public final class DurationArgument<C> extends CommandArgument<C, Duration> {
this.getDefaultDescription() this.getDefaultDescription()
); );
} }
} }
@ -277,7 +276,6 @@ public final class DurationArgument<C> extends CommandArgument<C, Duration> {
.map(unit -> input + unit) .map(unit -> input + unit)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
/** /**
@ -320,7 +318,5 @@ public final class DurationArgument<C> extends CommandArgument<C, Duration> {
public @NonNull String getInput() { public @NonNull String getInput() {
return this.input; return this.input;
} }
} }
} }

View file

@ -147,7 +147,6 @@ public class EnumArgument<C, E extends Enum<E>> extends CommandArgument<C, E> {
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription() 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() { public boolean isContextFree() {
return true; return true;
} }
} }
@ -278,7 +276,5 @@ public class EnumArgument<C, E extends Enum<E>> extends CommandArgument<C, E> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.input, this.enumClass); return Objects.hash(this.input, this.enumClass);
} }
} }
} }

View file

@ -179,7 +179,6 @@ public final class FloatArgument<C> extends CommandArgument<C, Float> {
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription() this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }
} }
@ -283,7 +282,6 @@ public final class FloatArgument<C> extends CommandArgument<C, Float> {
public boolean hasMin() { public boolean hasMin() {
return this.min != DEFAULT_MINIMUM; return this.min != DEFAULT_MINIMUM;
} }
} }
@ -364,7 +362,5 @@ public final class FloatArgument<C> extends CommandArgument<C, Float> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.parser); return Objects.hash(this.parser);
} }
} }
} }

View file

@ -191,7 +191,6 @@ public final class IntegerArgument<C> extends CommandArgument<C, Integer> {
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription() 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); return getSuggestions(this.min, this.max, input);
} }
} }
@ -425,7 +423,5 @@ public final class IntegerArgument<C> extends CommandArgument<C, Integer> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.parser); return Objects.hash(this.parser);
} }
} }
} }

View file

@ -179,7 +179,6 @@ public final class LongArgument<C> extends CommandArgument<C, Long> {
this.max, this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription() 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); 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() { public int hashCode() {
return Objects.hash(this.parser); return Objects.hash(this.parser);
} }
} }
} }

View file

@ -176,7 +176,6 @@ public final class ShortArgument<C> extends CommandArgument<C, Short> {
this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription() this.getDefaultValue(), this.getSuggestionsProvider(), this.getDefaultDescription()
); );
} }
} }
@ -288,7 +287,6 @@ public final class ShortArgument<C> extends CommandArgument<C, Short> {
public boolean hasMin() { public boolean hasMin() {
return this.min != DEFAULT_MINIMUM; return this.min != DEFAULT_MINIMUM;
} }
} }
@ -369,7 +367,5 @@ public final class ShortArgument<C> extends CommandArgument<C, Short> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.parser); return Objects.hash(this.parser);
} }
} }
} }

View file

@ -306,7 +306,6 @@ public final class StringArgument<C> extends CommandArgument<C, String> {
this.getDefaultValue(), this.suggestionsProvider, this.getDefaultDescription() this.getDefaultValue(), this.suggestionsProvider, this.getDefaultDescription()
); );
} }
} }
@ -465,7 +464,6 @@ public final class StringArgument<C> extends CommandArgument<C, String> {
public @NonNull StringMode getStringMode() { public @NonNull StringMode getStringMode() {
return this.stringMode; return this.stringMode;
} }
} }
@ -517,7 +515,5 @@ public final class StringArgument<C> extends CommandArgument<C, String> {
public @NonNull StringMode getStringMode() { public @NonNull StringMode getStringMode() {
return this.stringMode; return this.stringMode;
} }
} }
} }

View file

@ -217,7 +217,5 @@ public final class StringArrayArgument<C> extends CommandArgument<C, String[]> {
return ArgumentParseResult.success(result); return ArgumentParseResult.success(result);
} }
} }
} }
} }

View file

@ -127,7 +127,6 @@ public final class UUIDArgument<C> extends CommandArgument<C, UUID> {
this.getDefaultDescription() this.getDefaultDescription()
); );
} }
} }
@ -160,7 +159,6 @@ public final class UUIDArgument<C> extends CommandArgument<C, UUID> {
public boolean isContextFree() { public boolean isContextFree() {
return true; return true;
} }
} }
@ -203,7 +201,7 @@ public final class UUIDArgument<C> extends CommandArgument<C, UUID> {
if (this == o) { if (this == o) {
return true; return true;
} }
if (o == null ||this.getClass() != o.getClass()) { if (o == null || this.getClass() != o.getClass()) {
return false; return false;
} }
final UUIDParseException that = (UUIDParseException) o; final UUIDParseException that = (UUIDParseException) o;
@ -214,7 +212,5 @@ public final class UUIDArgument<C> extends CommandArgument<C, UUID> {
public int hashCode() { public int hashCode() {
return Objects.hash(this.input); return Objects.hash(this.input);
} }
} }
} }

View file

@ -82,5 +82,4 @@ public final class Caption {
this.key this.key
); );
} }
} }

View file

@ -42,5 +42,4 @@ public interface CaptionRegistry<C> {
* @return Caption * @return Caption
*/ */
@NonNull String getCaption(@NonNull Caption caption, @NonNull C sender); @NonNull String getCaption(@NonNull Caption caption, @NonNull C sender);
} }

View file

@ -68,5 +68,4 @@ public final class CaptionVariable {
public @NonNull String getValue() { public @NonNull String getValue() {
return this.value; return this.value;
} }
} }

View file

@ -40,5 +40,4 @@ public interface CaptionVariableReplacementHandler {
* @return Transformed message * @return Transformed message
*/ */
@NonNull String replaceVariables(@NonNull String string, @NonNull CaptionVariable... variables); @NonNull String replaceVariables(@NonNull String string, @NonNull CaptionVariable... variables);
} }

View file

@ -45,5 +45,4 @@ public interface FactoryDelegatingCaptionRegistry<C> extends CaptionRegistry<C>
@NonNull Caption caption, @NonNull Caption caption,
@NonNull BiFunction<Caption, C, String> factory @NonNull BiFunction<Caption, C, String> factory
); );
} }

View file

@ -187,5 +187,4 @@ public class SimpleCaptionRegistry<C> implements FactoryDelegatingCaptionRegistr
) { ) {
this.messageFactories.put(caption, messageFactory); this.messageFactories.put(caption, messageFactory);
} }
} }

View file

@ -42,5 +42,4 @@ public final class SimpleCaptionRegistryFactory<C> {
public @NonNull SimpleCaptionRegistry<C> create() { public @NonNull SimpleCaptionRegistry<C> create() {
return new SimpleCaptionRegistry<>(); return new SimpleCaptionRegistry<>();
} }
} }

View file

@ -43,5 +43,4 @@ public final class SimpleCaptionVariableReplacementHandler implements CaptionVar
} }
return replacedString; return replacedString;
} }
} }

View file

@ -115,5 +115,4 @@ public final class StandardCaptionKeys {
public static @NonNull Collection<@NonNull Caption> getStandardCaptionKeys() { public static @NonNull Collection<@NonNull Caption> getStandardCaptionKeys() {
return Collections.unmodifiableCollection(RECOGNIZED_CAPTIONS); return Collections.unmodifiableCollection(RECOGNIZED_CAPTIONS);
} }
} }

View file

@ -740,7 +740,5 @@ public class CommandContext<C> {
public boolean wasSuccess() { public boolean wasSuccess() {
return this.success; return this.success;
} }
} }
} }

View file

@ -68,5 +68,4 @@ public interface CommandContextFactory<C> {
@NonNull C sender, @NonNull C sender,
@NonNull CommandManager<C> commandManager @NonNull CommandManager<C> commandManager
); );
} }

View file

@ -57,5 +57,4 @@ public final class StandardCommandContextFactory<C> implements CommandContextFac
commandManager commandManager
); );
} }
} }

View file

@ -108,5 +108,4 @@ public final class AmbiguousNodeException extends IllegalStateException {
return stringBuilder.append(")") return stringBuilder.append(")")
.toString(); .toString();
} }
} }

View file

@ -60,5 +60,4 @@ public class ArgumentParseException extends CommandParseException {
public synchronized @NonNull Throwable getCause() { public synchronized @NonNull Throwable getCause() {
return this.cause; return this.cause;
} }
} }

View file

@ -73,5 +73,4 @@ public class CommandExecutionException extends IllegalArgumentException {
public @Nullable CommandContext<?> getCommandContext() { public @Nullable CommandContext<?> getCommandContext() {
return this.commandContext; return this.commandContext;
} }
} }

View file

@ -72,5 +72,4 @@ public class CommandParseException extends IllegalArgumentException {
public @NonNull List<@NonNull CommandArgument<?, ?>> getCurrentChain() { public @NonNull List<@NonNull CommandArgument<?, ?>> getCurrentChain() {
return Collections.unmodifiableList(this.currentChain); return Collections.unmodifiableList(this.currentChain);
} }
} }

View file

@ -106,5 +106,4 @@ public final class InvalidCommandSenderException extends CommandParseException {
public @Nullable Command<?> getCommand() { public @Nullable Command<?> getCommand() {
return this.command; return this.command;
} }
} }

View file

@ -69,5 +69,4 @@ public class InvalidSyntaxException extends CommandParseException {
public final String getMessage() { public final String getMessage() {
return String.format("Invalid command syntax. Correct syntax is: %s", this.correctSyntax); return String.format("Invalid command syntax. Correct syntax is: %s", this.correctSyntax);
} }
} }

View file

@ -58,5 +58,4 @@ public final class NoCommandInLeafException extends IllegalStateException {
public @NonNull CommandArgument<?, ?> getCommandArgument() { public @NonNull CommandArgument<?, ?> getCommandArgument() {
return this.commandArgument; return this.commandArgument;
} }
} }

Some files were not shown because too many files have changed in this diff Show more