I hate the fact that we started using Checkstyle.

Whose decision was that anyway..?
This commit is contained in:
Alexander Söderberg 2021-07-10 11:38:42 +01:00 committed by Jason
parent 5934c2fd3b
commit 6871341291
4 changed files with 21 additions and 10 deletions

View file

@ -485,7 +485,8 @@ public final class AnnotationParser<C> {
builder = builder.senderType(senderType);
}
try {
final MethodCommandExecutionHandler.CommandMethodContext<C> context = new MethodCommandExecutionHandler.CommandMethodContext<>(
final MethodCommandExecutionHandler.CommandMethodContext<C> context =
new MethodCommandExecutionHandler.CommandMethodContext<>(
instance,
commandArguments,
method,
@ -494,8 +495,9 @@ public final class AnnotationParser<C> {
/* Create the command execution handler */
CommandExecutionHandler<C> commandExecutionHandler = new MethodCommandExecutionHandler<>(context);
for (final Map.Entry<Predicate<Method>, Function<MethodCommandExecutionHandler.CommandMethodContext<C>, MethodCommandExecutionHandler<C>>> entry :
commandMethodFactories.entrySet()) {
for (final Map.Entry<Predicate<Method>, Function<MethodCommandExecutionHandler.CommandMethodContext<C>,
MethodCommandExecutionHandler<C>>> entry
: this.commandMethodFactories.entrySet()) {
if (entry.getKey().test(method)) {
commandExecutionHandler = entry.getValue().apply(context);

View file

@ -74,10 +74,12 @@ public class MethodCommandExecutionHandler<C> implements CommandExecutionHandler
public void execute(final @NonNull CommandContext<C> commandContext) {
/* Invoke the command method */
try {
this.methodHandle.invokeWithArguments(createParameterValues(
commandContext,
commandContext.flags(),
true)
this.methodHandle.invokeWithArguments(
this.createParameterValues(
commandContext,
commandContext.flags(),
true
)
);
} catch (final Error e) {
throw e;
@ -86,7 +88,15 @@ public class MethodCommandExecutionHandler<C> implements CommandExecutionHandler
}
}
protected List<Object> createParameterValues(
/**
* Creates a list containing the values for all method parameters
*
* @param commandContext The context
* @param flagContext The flag context
* @param throwOnMissing Whether exceptions should be thrown on missing parameters
* @return A list containing all parameters, in order
*/
protected final List<Object> createParameterValues(
final CommandContext<C> commandContext,
final FlagContext flagContext,
final boolean throwOnMissing

View file

@ -57,7 +57,7 @@ public interface CommandExecutionHandler<C> {
default CompletableFuture<@Nullable Object> executeFuture(@NonNull CommandContext<C> commandContext) {
final CompletableFuture<Object> future = new CompletableFuture<>();
try {
execute(commandContext);
this.execute(commandContext);
/* The command executed successfully */
future.complete(null);
} catch (final Throwable throwable) {

View file

@ -24,7 +24,6 @@
package cloud.commandframework.extra.confirmation;
import cloud.commandframework.CommandManager;
import cloud.commandframework.context.CommandContext;
import cloud.commandframework.execution.CommandExecutionHandler;
import cloud.commandframework.execution.postprocessor.CommandPostprocessingContext;
import cloud.commandframework.execution.postprocessor.CommandPostprocessor;