🚚 Finalize annotation transition
This commit is contained in:
parent
f7c00244e7
commit
0fbe1fe6a2
21 changed files with 184 additions and 190 deletions
|
|
@ -423,10 +423,9 @@ public class Command<C> {
|
|||
*/
|
||||
public <U, V, O> @NonNull Builder<C> argumentPair(@NonNull final String name,
|
||||
@NonNull final TypeToken<O> outputType,
|
||||
@NonNull final Pair<@NonNull String, @NonNull String> names,
|
||||
@NonNull final Pair<@NonNull Class<U>, @NonNull Class<V>> parserPair,
|
||||
@NonNull final Function<Pair<@NonNull U, @NonNull V>,
|
||||
@NonNull O> mapper,
|
||||
@NonNull final Pair<String, String> names,
|
||||
@NonNull final Pair<Class<U>, Class<V>> parserPair,
|
||||
@NonNull final Function<Pair<U, V>, O> mapper,
|
||||
@NonNull final Description description) {
|
||||
if (this.commandManager == null) {
|
||||
throw new IllegalStateException("This cannot be called from a command that has no command manager attached");
|
||||
|
|
@ -455,10 +454,8 @@ public class Command<C> {
|
|||
* @return Builder instance with the argument inserted
|
||||
*/
|
||||
public <U, V, W> @NonNull Builder<C> argumentTriplet(@NonNull final String name,
|
||||
@NonNull final Triplet<@NonNull String,
|
||||
@NonNull String, @NonNull String> names,
|
||||
@NonNull final Triplet<@NonNull Class<U>,
|
||||
@NonNull Class<V>, @NonNull Class<W>> parserTriplet,
|
||||
@NonNull final Triplet<String, String, String> names,
|
||||
@NonNull final Triplet<Class<U>, Class<V>, Class<W>> parserTriplet,
|
||||
@NonNull final Description description) {
|
||||
if (this.commandManager == null) {
|
||||
throw new IllegalStateException("This cannot be called from a command that has no command manager attached");
|
||||
|
|
@ -489,12 +486,10 @@ public class Command<C> {
|
|||
*/
|
||||
public <U, V, W, O> @NonNull Builder<C> argumentTriplet(@NonNull final String name,
|
||||
@NonNull final TypeToken<O> outputType,
|
||||
@NonNull final Triplet<@NonNull String,
|
||||
@NonNull String, @NonNull String> names,
|
||||
@NonNull final Triplet<@NonNull Class<U>,
|
||||
@NonNull Class<V>, @NonNull Class<W>> parserTriplet,
|
||||
@NonNull final Function<@NonNull Triplet<@NonNull U,
|
||||
@NonNull V, @NonNull W>, @NonNull O> mapper,
|
||||
@NonNull final Triplet<String, String, String> names,
|
||||
@NonNull final Triplet<Class<U>, Class<V>,
|
||||
Class<W>> parserTriplet,
|
||||
@NonNull final Function<Triplet<U, V, W>, O> mapper,
|
||||
@NonNull final Description description) {
|
||||
if (this.commandManager == null) {
|
||||
throw new IllegalStateException("This cannot be called from a command that has no command manager attached");
|
||||
|
|
|
|||
|
|
@ -28,13 +28,31 @@ import cloud.commandframework.arguments.StaticArgument;
|
|||
import cloud.commandframework.arguments.compound.CompoundArgument;
|
||||
import cloud.commandframework.arguments.parser.ArgumentParseResult;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.exceptions.*;
|
||||
import cloud.commandframework.exceptions.AmbiguousNodeException;
|
||||
import cloud.commandframework.exceptions.ArgumentParseException;
|
||||
import cloud.commandframework.exceptions.InvalidCommandSenderException;
|
||||
import cloud.commandframework.exceptions.InvalidSyntaxException;
|
||||
import cloud.commandframework.exceptions.NoCommandInLeafException;
|
||||
import cloud.commandframework.exceptions.NoPermissionException;
|
||||
import cloud.commandframework.exceptions.NoSuchCommandException;
|
||||
import cloud.commandframework.permission.CommandPermission;
|
||||
import cloud.commandframework.permission.OrPermission;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Queue;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>
|
|||
}
|
||||
|
||||
@Override
|
||||
public final int compareTo(@NonNull CommandArgument<?, ?> o) {
|
||||
public final int compareTo(@NonNull final CommandArgument<?, ?> o) {
|
||||
if (this instanceof StaticArgument) {
|
||||
if (o instanceof StaticArgument) {
|
||||
return (this.getName().compareTo(o.getName()));
|
||||
|
|
@ -474,7 +474,7 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>
|
|||
return this.defaultValue;
|
||||
}
|
||||
|
||||
protected final @NonNull BiFunction<@NonNull CommandContext<C>,@NonNull String, @NonNull List<String>>
|
||||
protected final @NonNull BiFunction<@NonNull CommandContext<C>, @NonNull String, @NonNull List<String>>
|
||||
getSuggestionsProvider() {
|
||||
return this.suggestionsProvider;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2020 Alexander Söderberg
|
||||
// Copyright (c) 2020 Alexander Söderberg & Contributors
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2020 Alexander Söderberg
|
||||
// Copyright (c) 2020 Alexander Söderberg & Contributors
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
@ -134,7 +134,7 @@ public class ArgumentTriplet<C, U, V, W, O> extends CompoundArgument<Triplet<U,
|
|||
* @return Argument triplet
|
||||
*/
|
||||
public @NonNull ArgumentTriplet<@NonNull C, @NonNull U, @NonNull V,
|
||||
@NonNull W, Triplet<@NonNull U, @NonNull V, @NonNull W>> simple() {
|
||||
@NonNull W, Triplet<U, V, W>> simple() {
|
||||
return new ArgumentTriplet<>(this.required,
|
||||
this.name,
|
||||
this.names,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2020 Alexander Söderberg
|
||||
// Copyright (c) 2020 Alexander Söderberg & Contributors
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2020 Alexander Söderberg
|
||||
// Copyright (c) 2020 Alexander Söderberg & Contributors
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public final class StringArgument<C> extends CommandArgument<C, String> {
|
|||
* @return Created argument
|
||||
*/
|
||||
public static <C> @NonNull CommandArgument<C, String> optional(@NonNull final String name,
|
||||
@NonNull String defaultString) {
|
||||
@NonNull final String defaultString) {
|
||||
return StringArgument.<C>newBuilder(name).asOptionalWithDefault(defaultString).build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2020 Alexander Söderberg
|
||||
// Copyright (c) 2020 Alexander Söderberg & Contributors
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class Triplet<U, V, W> implements Tuple {
|
|||
*
|
||||
* @return First value
|
||||
*/
|
||||
public final @NonNull U getFirst() {
|
||||
public final U getFirst() {
|
||||
return this.first;
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ public class Triplet<U, V, W> implements Tuple {
|
|||
*
|
||||
* @return Second value
|
||||
*/
|
||||
public final @NonNull V getSecond() {
|
||||
public final V getSecond() {
|
||||
return this.second;
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ public class Triplet<U, V, W> implements Tuple {
|
|||
*
|
||||
* @return Third value
|
||||
*/
|
||||
public final @NonNull W getThird() {
|
||||
public final W getThird() {
|
||||
return this.third;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
class CommandPermissionTest {
|
||||
|
||||
private final static CommandManager<TestCommandSender> manager = new PermissionOutputtingCommandManager();
|
||||
|
|
@ -59,12 +57,11 @@ class CommandPermissionTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@Nonnull final TestCommandSender sender,
|
||||
@Nonnull final String permission) {
|
||||
public boolean hasPermission(final TestCommandSender sender,
|
||||
final String permission) {
|
||||
return acceptOne && permission.equalsIgnoreCase("test.permission.four");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CommandMeta createDefaultCommandMeta() {
|
||||
return SimpleCommandMeta.empty();
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CommandPostProcessorTest {
|
||||
|
||||
private static CommandManager<TestCommandSender> manager;
|
||||
|
|
@ -56,7 +54,7 @@ public class CommandPostProcessorTest {
|
|||
static final class SamplePostprocessor implements CommandPostprocessor<TestCommandSender> {
|
||||
|
||||
@Override
|
||||
public void accept(@Nonnull final CommandPostprocessingContext<TestCommandSender> context) {
|
||||
public void accept(final CommandPostprocessingContext<TestCommandSender> context) {
|
||||
ConsumerService.interrupt();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CommandPreProcessorTest {
|
||||
|
||||
private static CommandManager<TestCommandSender> manager;
|
||||
|
|
@ -72,7 +70,7 @@ public class CommandPreProcessorTest {
|
|||
static final class SamplePreprocessor implements CommandPreprocessor<TestCommandSender> {
|
||||
|
||||
@Override
|
||||
public void accept(@Nonnull final CommandPreprocessingContext<TestCommandSender> context) {
|
||||
public void accept(final CommandPreprocessingContext<TestCommandSender> context) {
|
||||
try {
|
||||
final int num = Integer.parseInt(context.getInputQueue().removeFirst());
|
||||
context.getCommandContext().store("int", num);
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ import cloud.commandframework.execution.CommandExecutionCoordinator;
|
|||
import cloud.commandframework.internal.CommandRegistrationHandler;
|
||||
import cloud.commandframework.meta.SimpleCommandMeta;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class TestCommandManager extends CommandManager<TestCommandSender> {
|
||||
|
||||
/**
|
||||
|
|
@ -38,15 +36,14 @@ public class TestCommandManager extends CommandManager<TestCommandSender> {
|
|||
super(CommandExecutionCoordinator.simpleCoordinator(), CommandRegistrationHandler.nullCommandRegistrationHandler());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@Override
|
||||
public final SimpleCommandMeta createDefaultCommandMeta() {
|
||||
return SimpleCommandMeta.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean hasPermission(@Nonnull final TestCommandSender sender,
|
||||
@Nonnull final String permission) {
|
||||
public final boolean hasPermission(final TestCommandSender sender, final String permission) {
|
||||
System.out.printf("Testing permission: %s\n", permission);
|
||||
return !permission.equalsIgnoreCase("no");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue