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

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

View file

@ -39,7 +39,8 @@ public interface CloudCapability {
*
* @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 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)
@ -372,7 +372,7 @@ public class Command<C> {
* @return Argument description
* @throws IllegalArgumentException If the command argument does not exist
* @deprecated More than one matching command argument may exist per command.
* Use {@link #getArguments()} and search in that, instead.
* Use {@link #getArguments()} and search in that, instead.
*/
@Deprecated
@API(status = API.Status.DEPRECATED)
@ -807,7 +807,7 @@ public class Command<C> {
* @param <O> Output type
* @return Builder instance with the argument inserted
* @deprecated for removal since 1.4.0. Use
* {@link #argumentPair(String, TypeToken, Pair, Pair, BiFunction, ArgumentDescription)} instead.
* {@link #argumentPair(String, TypeToken, Pair, Pair, BiFunction, ArgumentDescription)} instead.
*/
@Deprecated
@API(status = API.Status.DEPRECATED, since = "1.4.0")
@ -879,7 +879,7 @@ public class Command<C> {
* @param <W> Third type
* @return Builder instance with the argument inserted
* @deprecated for removal since 1.4.0. Use {@link #argumentTriplet(String, Triplet, Triplet, ArgumentDescription)}
* instead.
* instead.
*/
@Deprecated
@API(status = API.Status.DEPRECATED, since = "1.4.0")
@ -945,7 +945,7 @@ public class Command<C> {
* @param <O> Output type
* @return Builder instance with the argument inserted
* @deprecated for removal since 1.4.0, use
* {@link #argumentTriplet(String, TypeToken, Triplet, Triplet, BiFunction, ArgumentDescription)} instead.
* {@link #argumentTriplet(String, TypeToken, Triplet, Triplet, BiFunction, ArgumentDescription)} instead.
*/
@Deprecated
@API(status = API.Status.DEPRECATED, since = "1.4.0")
@ -1199,7 +1199,5 @@ public class Command<C> {
this.commandMeta
);
}
}
}

View file

@ -43,7 +43,7 @@ public final class CommandComponent<C> {
/**
* Initializes a new CommandComponent
*
* @param commandArgument Command Component Argument
* @param commandArgument Command Component Argument
* @param commandDescription Command Component Description
*/
private CommandComponent(
@ -111,14 +111,15 @@ 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
);
}
/**
* Creates a new CommandComponent with the provided argument and description
*
* @param <C> Command sender type
* @param commandArgument Command Component Argument
* @param <C> Command sender type
* @param commandArgument Command Component Argument
* @param commandDescription Command Component Description
* @return new CommandComponent
* @deprecated for removal since 1.4.0. Use {@link #of(CommandArgument, ArgumentDescription)} instead.
@ -135,8 +136,8 @@ public final class CommandComponent<C> {
/**
* Creates a new CommandComponent with the provided argument and description
*
* @param <C> Command sender type
* @param commandArgument Command Component Argument
* @param <C> Command sender type
* @param commandArgument Command Component Argument
* @param commandDescription Command Component Description
* @return new CommandComponent
*/

View file

@ -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);
}
}
@ -483,7 +481,7 @@ public final class CommandHelpHandler<C> {
public String toString() {
return "VerboseHelpTopic{"
+ "command=" + this.command
+ ", description='" +this.description + '\''
+ ", description='" + this.description + '\''
+ '}';
}
@ -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);
}
}
}

View file

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

View file

@ -139,11 +139,10 @@ public final class CommandTree<C> {
return Pair.of(
null,
new NoSuchCommandException(
commandContext.getSender(),
new ArrayList<>(),
this.stringOrEmpty(args.peek()
commandContext.getSender(),
new ArrayList<>(),
this.stringOrEmpty(args.peek())
)
)
);
}
@ -304,10 +303,10 @@ public final class CommandTree<C> {
if (!commandQueue.isEmpty()) {
final String literal = commandQueue.peek();
final boolean matchesLiteral = children.stream()
.filter(n -> n.getValue() instanceof StaticArgument)
.map(n -> (StaticArgument<?>) n.getValue())
.flatMap(arg -> Stream.concat(Stream.of(arg.getName()), arg.getAliases().stream()))
.anyMatch(arg -> arg.equals(literal));
.filter(n -> n.getValue() instanceof StaticArgument)
.map(n -> (StaticArgument<?>) n.getValue())
.flatMap(arg -> Stream.concat(Stream.of(arg.getName()), arg.getAliases().stream()))
.anyMatch(arg -> arg.equals(literal));
if (matchesLiteral) {
return Pair.of(null, null);
@ -381,8 +380,8 @@ public final class CommandTree<C> {
return Pair.of(null, new InvalidSyntaxException(
this.commandManager.getCommandSyntaxFormatter()
.apply(Objects.requireNonNull(
child.getValue()
.getOwningCommand())
child.getValue()
.getOwningCommand())
.getArguments(), child),
commandContext.getSender(), this.getChain(root)
.stream()
@ -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 + '}';
}
}
}

View file

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

View file

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

View file

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

View file

@ -71,7 +71,7 @@ public interface AnnotationAccessor {
* @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);
}
@ -104,14 +104,12 @@ public interface AnnotationAccessor {
@Override
public <A extends Annotation> @Nullable A annotation(final @NonNull Class<A> clazz) {
return null;
return null;
}
@Override
public @NonNull Collection<@NonNull Annotation> annotations() {
return Collections.emptyList();
}
}
}

View file

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

View file

@ -51,7 +51,7 @@ public final class GuiceInjectionService<C> implements InjectionService<C> {
* Create a new Guice injection service that wraps the given injector
*
* @param injector Injector to wrap
* @param <C> Command sender type
* @param <C> Command sender type
* @return the created injection service
*/
public static <C> GuiceInjectionService<C> create(final @NonNull Injector injector) {
@ -67,5 +67,4 @@ public final class GuiceInjectionService<C> implements InjectionService<C> {
}
return null;
}
}

View file

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

View file

@ -117,11 +117,11 @@ public final class ParameterInjectorRegistry<C> implements InjectionService<C> {
* {@link InjectionService injection services}, and not just the {@link ParameterInjector injectors}
* registered using {@link #registerInjector(Class, ParameterInjector)}.
*
* @param clazz Class of the to inject
* @param context The command context that requests the injection
* @param clazz Class of the to inject
* @param context The command context that requests the injection
* @param annotationAccessor Annotation accessor for the injection. If the object is requested without access to annotations,
* use {@link AnnotationAccessor#empty()}
* @param <T> Type to inject
* @param <T> Type to inject
* @return The injected value, if an injector was able to provide a value
* @since 1.4.0
*/
@ -153,5 +153,4 @@ public final class ParameterInjectorRegistry<C> implements InjectionService<C> {
this.servicePipeline.registerServiceImplementation(new TypeToken<InjectionService<C>>() {
}, service, Collections.emptyList());
}
}

View file

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

View file

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

View file

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

View file

@ -178,14 +178,14 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
@NonNull ArgumentParseResult<Boolean>>> argumentPreprocessors
) {
this(
required,
name,
parser,
defaultValue,
valueType,
suggestionsProvider,
ArgumentDescription.empty(),
argumentPreprocessors
required,
name,
parser,
defaultValue,
valueType,
suggestionsProvider,
ArgumentDescription.empty(),
argumentPreprocessors
);
}
@ -219,7 +219,7 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
* @param defaultValue Default value used when no value is provided by the command sender
* @param valueType Type produced by the parser
* @param suggestionsProvider Suggestions provider
* @param defaultDescription Default description to use when registering
* @param defaultDescription Default description to use when registering
* @since 1.4.0
*/
@API(status = API.Status.STABLE, since = "1.4.0")
@ -266,7 +266,7 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
* @param defaultValue Default value used when no value is provided by the command sender
* @param valueType Type produced by the parser
* @param suggestionsProvider Suggestions provider
* @param defaultDescription Default description to use when registering
* @param defaultDescription Default description to use when registering
* @since 1.4.0
*/
@API(status = API.Status.STABLE, since = "1.4.0")
@ -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();
}
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -152,7 +152,5 @@ public final class StaticArgument<C> extends CommandArgument<C, String> {
this.allAcceptedAliases.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);
}
}
}

View file

@ -200,7 +200,5 @@ public class ArgumentTriplet<C, U, V, W, O> extends CompoundArgument<Triplet<U,
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;
return ((ArgumentParser<C, ?>) this.parsers[argument]).suggestions(commandContext, input);
}
}
}

View file

@ -133,7 +133,7 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
* Will consume all but the last element from the input queue.
*
* @param commandContext Command context
* @param inputQueue The input queue of arguments
* @param inputQueue The input queue of arguments
* @return current flag being typed, or {@code empty()} if none is
*/
public @NonNull Optional<String> parseCurrentFlag(
@ -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;
}
}
}

View file

@ -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);
}
}
}

View file

@ -236,8 +236,8 @@ public final class FlagContext {
/**
* Get a flag value
*
* @param name Flag name
* @param <T> Value type
* @param name Flag name
* @param <T> Value type
* @return Stored value if present, else {@code null}
* @since 1.3.0
*/
@ -252,8 +252,8 @@ public final class FlagContext {
/**
* Get a flag value
*
* @param flag Flag name
* @param <T> Value type
* @param flag Flag name
* @param <T> Value type
* @return Stored value if present, else {@code null}
* @since 1.4.0
*/
@ -263,5 +263,4 @@ public final class FlagContext {
) {
return this.getValue(flag).orElse(null);
}
}

View file

@ -73,7 +73,7 @@ public abstract class ArgumentParseResult<T> {
* If this result is successful, transform the output value.
*
* @param mapper the transformation
* @param <U> the result type
* @param <U> the result type
* @return a new result if successful, otherwise a failure
* @since 1.5.0
*/
@ -84,7 +84,7 @@ public abstract class ArgumentParseResult<T> {
* If this result is successful, transform the output value, returning another parse result.
*
* @param mapper the transformation
* @param <U> the result type
* @param <U> the result type
* @return a new result if successful, otherwise a failure
* @since 1.5.0
*/
@ -132,7 +132,7 @@ public abstract class ArgumentParseResult<T> {
@Override
public @NonNull <U> ArgumentParseResult<U> flatMapParsedValue(final Function<T, ArgumentParseResult<U>> mapper) {
return mapper.apply(this.value);
return mapper.apply(this.value);
}
@Override
@ -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));
}
}
}

View file

@ -97,7 +97,7 @@ public interface ArgumentParser<C, T> {
* Create a derived argument parser preserving all properties of this parser, but converting the output type.
*
* @param mapper the mapper to apply
* @param <O> the result type
* @param <O> the result type
* @return a derived parser.
* @since 1.5.0
*/
@ -127,5 +127,4 @@ public interface ArgumentParser<C, T> {
default int getRequestedArgumentCount() {
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")
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 + '}';
}
}

View file

@ -88,5 +88,4 @@ public class ParserParameter<T> {
public final int hashCode() {
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() {
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 String name
);
}

View file

@ -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);
}
}

View file

@ -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);
}
}
}

View file

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

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -51,7 +51,7 @@ public final class CharArgument<C> extends CommandArgument<C, Character> {
final @Nullable BiFunction<@NonNull CommandContext<C>,
@NonNull String, @NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) {
) {
super(required, name, new CharacterParser<>(), defaultValue, Character.class, suggestionsProvider, defaultDescription);
}
@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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;
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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;
}
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -40,5 +40,4 @@ public interface CaptionVariableReplacementHandler {
* @return Transformed message
*/
@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 BiFunction<Caption, C, String> factory
);
}

View file

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

View file

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

View file

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

View file

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

View file

@ -454,7 +454,7 @@ public class CommandContext<C> {
* if there's no value associated with the given argument
*
* @param keyHolder Holder of the identifying key
* @param <T> Argument type
* @param <T> Argument type
* @return Stored value
* @throws NullPointerException If no such value is stored
*/
@ -467,7 +467,7 @@ public class CommandContext<C> {
* if there's no value associated with the given argument
*
* @param keyHolder Holder of the identifying key
* @param <T> Argument type
* @param <T> Argument type
* @return Stored value
* @throws NullPointerException If no such value is stored
* @since 1.4.0
@ -740,7 +740,5 @@ public class CommandContext<C> {
public boolean wasSuccess() {
return this.success;
}
}
}

View file

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

View file

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

View file

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

View file

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

View file

@ -53,7 +53,7 @@ public class CommandExecutionException extends IllegalArgumentException {
/**
* Exception thrown when there is an exception during execution of a command handler
*
* @param cause Exception thrown during the execution of a command handler
* @param cause Exception thrown during the execution of a command handler
* @param commandContext Command context
* @since 1.4.0
*/
@ -73,5 +73,4 @@ public class CommandExecutionException extends IllegalArgumentException {
public @Nullable CommandContext<?> getCommandContext() {
return this.commandContext;
}
}

View file

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

View file

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

View file

@ -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);
}
}

View file

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

View file

@ -81,5 +81,4 @@ public class NoPermissionException extends CommandParseException {
public final synchronized Throwable initCause(final Throwable cause) {
return this;
}
}

View file

@ -87,5 +87,4 @@ public final class NoSuchCommandException extends CommandParseException {
public synchronized Throwable initCause(final Throwable cause) {
return this;
}
}

View file

@ -54,5 +54,4 @@ public class NoInputProvidedException extends ParserException {
StandardCaptionKeys.ARGUMENT_PARSE_FAILURE_NO_INPUT_PROVIDED
);
}
}

View file

@ -113,5 +113,4 @@ public abstract class NumberParseException extends ParserException {
public Number getMax() {
return this.max;
}
}

View file

@ -100,5 +100,4 @@ public class ParserException extends IllegalArgumentException {
public final @NonNull CommandContext<?> getContext() {
return this.context;
}
}

View file

@ -181,7 +181,5 @@ public final class AsynchronousCommandExecutionCoordinator<C> extends CommandExe
public @NonNull Function<@NonNull CommandTree<C>, @NonNull CommandExecutionCoordinator<C>> build() {
return tree -> new AsynchronousCommandExecutionCoordinator<>(this.executor, this.synchronizeParsing, tree);
}
}
}

View file

@ -141,7 +141,5 @@ public abstract class CommandExecutionCoordinator<C> {
}
return completableFuture;
}
}
}

View file

@ -112,7 +112,6 @@ public interface CommandExecutionHandler<C> {
@Override
public void execute(final @NonNull CommandContext<C> commandContext) {
}
}
/**
@ -137,7 +136,6 @@ public interface CommandExecutionHandler<C> {
CompletableFuture<@Nullable Void> executeFuture(
@NonNull CommandContext<C> commandContext
);
}
/**
@ -180,7 +178,5 @@ public interface CommandExecutionHandler<C> {
return composedHandler;
}
}
}

View file

@ -54,5 +54,4 @@ public class CommandResult<C> {
public @NonNull CommandContext<C> getCommandContext() {
return this.commandContext;
}
}

View file

@ -56,5 +56,4 @@ public final class FilteringCommandSuggestionProcessor<C> implements CommandSugg
}
return suggestions;
}
}

View file

@ -44,5 +44,4 @@ public final class AcceptingCommandPostprocessor<C> implements CommandPostproces
public void accept(final @NonNull CommandPostprocessingContext<C> context) {
context.getCommandContext().store(PROCESSED_INDICATOR_KEY, "true");
}
}

View file

@ -89,5 +89,4 @@ public final class CommandPostprocessingContext<C> {
public int hashCode() {
return Objects.hash(this.getCommandContext(), this.getCommand());
}
}

View file

@ -44,5 +44,4 @@ public final class AcceptingCommandPreprocessor<C> implements CommandPreprocesso
public void accept(final @NonNull CommandPreprocessingContext<C> context) {
context.getCommandContext().store(PROCESSED_INDICATOR_KEY, "true");
}
}

View file

@ -90,5 +90,4 @@ public final class CommandPreprocessingContext<C> {
public int hashCode() {
return Objects.hash(this.getCommandContext(), this.getInputQueue());
}
}

View file

@ -191,7 +191,5 @@ public class CommandConfirmationManager<C> {
/* Interrupt */
ConsumerService.interrupt();
}
}
}

View file

@ -77,7 +77,5 @@ public final class CommandInputTokenizer {
private @NonNull StringTokenizer createStringTokenizer() {
return new StringTokenizer(CommandInputTokenizer.this.input, DELIMITER);
}
}
}

View file

@ -80,5 +80,4 @@ public interface CommandRegistrationHandler {
public void unregisterRootCommand(final @NonNull StaticArgument<?> rootCommand) {
}
}
}

View file

@ -51,5 +51,4 @@ public interface CloudKey<T> {
* @return The type of the key value.
*/
@NonNull TypeToken<@NonNull T> getType();
}

View file

@ -42,5 +42,4 @@ public interface CloudKeyHolder<T> {
* @return Identifying key.
*/
@NonNull CloudKey<T> getKey();
}

View file

@ -106,5 +106,4 @@ public final class SimpleCloudKey<@NonNull T> implements CloudKey<T> {
public String toString() {
return this.name;
}
}

View file

@ -49,9 +49,9 @@ public abstract class CommandMeta {
public static final Key<String> DESCRIPTION = Key.of(String.class, "description");
public static final Key<String> LONG_DESCRIPTION = Key.of(String.class, "long-description");
public static final Key<Boolean> HIDDEN = Key.of(
Boolean.class,
"cloud:hidden",
meta -> Boolean.valueOf(meta.getOrDefault(LEGACY_HIDDEN, "false"))
Boolean.class,
"cloud:hidden",
meta -> Boolean.valueOf(meta.getOrDefault(LEGACY_HIDDEN, "false"))
);
/**
@ -147,8 +147,8 @@ public abstract class CommandMeta {
* Create a new metadata key.
*
* @param type the value type
* @param key the name for the key
* @param <T> the value type
* @param key the name for the key
* @param <T> the value type
* @return a new key
*/
static <T> @NonNull Key<T> of(final @NonNull Class<T> type, final @NonNull String key) {
@ -157,9 +157,9 @@ public abstract class CommandMeta {
}
return new SimpleKey<>(
TypeToken.get(requireNonNull(type, "type")),
requireNonNull(key, "key"),
null
TypeToken.get(requireNonNull(type, "type")),
requireNonNull(key, "key"),
null
);
}
@ -167,31 +167,32 @@ public abstract class CommandMeta {
* Create a new metadata key.
*
* @param type the value type
* @param key the name for the key
* @param <T> the value type
* @param key the name for the key
* @param <T> the value type
* @return a new key
*/
static <T> @NonNull Key<T> of(final @NonNull TypeToken<T> type, final @NonNull String key) {
return new SimpleKey<>(
requireNonNull(type, "type"),
requireNonNull(key, "key"),
null
requireNonNull(type, "type"),
requireNonNull(key, "key"),
null
);
}
/**
* Create a new metadata key.
*
* @param type the value type
* @param key the name for the key
* @param type the value type
* @param key the name for the key
* @param fallbackDerivation A function that will be called if no value is present for the key
* @param <T> the value type
* @param <T> the value type
* @return a new key
*/
static <T> @NonNull Key<T> of(
final @NonNull Class<T> type,
final @NonNull String key,
final @NonNull Function<@NonNull CommandMeta, @Nullable T> fallbackDerivation) {
final @NonNull Function<@NonNull CommandMeta, @Nullable T> fallbackDerivation
) {
return new SimpleKey<>(
TypeToken.get(requireNonNull(type, "type")),
requireNonNull(key, "key"),
@ -202,10 +203,10 @@ public abstract class CommandMeta {
/**
* Create a new metadata key.
*
* @param type the value type
* @param key the name for the key
* @param type the value type
* @param key the name for the key
* @param fallbackDerivation A function that will be called if no value is present for the key
* @param <T> the value type
* @param <T> the value type
* @return a new key
*/
static <T> @NonNull Key<T> of(
@ -238,7 +239,8 @@ public abstract class CommandMeta {
*
* @return the key type
*/
@Override @NonNull String getName();
@Override
@NonNull String getName();
/**
* Get a function that can be used to compute a fallback based on existing meta.
@ -248,7 +250,5 @@ public abstract class CommandMeta {
* @return the fallback derivation
*/
@Nullable Function<@NonNull CommandMeta, @Nullable V> getFallbackDerivation();
}
}

View file

@ -209,8 +209,8 @@ public class SimpleCommandMeta extends CommandMeta {
final @NonNull Key<V> key,
final @NonNull V value
) {
this.map.put(key.getName(), value);
return this;
this.map.put(key.getName(), value);
return this;
}
/**
@ -221,7 +221,5 @@ public class SimpleCommandMeta extends CommandMeta {
public @NonNull SimpleCommandMeta build() {
return new SimpleCommandMeta(this.map, false);
}
}
}

View file

@ -38,9 +38,9 @@ final class SimpleKey<V> implements CommandMeta.Key<V> {
private final @Nullable Function<@NonNull CommandMeta, @Nullable V> derivationFunction;
SimpleKey(
final @NonNull TypeToken<V> valueType,
final @NonNull String name,
final @Nullable Function<@NonNull CommandMeta, @Nullable V> derivationFunction
final @NonNull TypeToken<V> valueType,
final @NonNull String name,
final @Nullable Function<@NonNull CommandMeta, @Nullable V> derivationFunction
) {
this.valueType = valueType;
this.name = name;
@ -80,5 +80,4 @@ final class SimpleKey<V> implements CommandMeta.Key<V> {
return 7 * GenericTypeReflector.hashCode(this.valueType.getAnnotatedType())
+ 31 * this.name.hashCode();
}
}

View file

@ -97,5 +97,4 @@ public final class AndPermission implements CommandPermission {
public int hashCode() {
return Objects.hash(this.getPermissions());
}
}

View file

@ -116,5 +116,4 @@ public interface CommandPermission {
permission.addAll(Arrays.asList(other));
return AndPermission.of(permission);
}
}

View file

@ -97,5 +97,4 @@ public final class OrPermission implements CommandPermission {
public int hashCode() {
return Objects.hash(this.getPermissions());
}
}

View file

@ -105,5 +105,4 @@ public final class Permission implements CommandPermission {
public int hashCode() {
return Objects.hash(this.getPermission());
}
}

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