Add errorprone and fix warnings/errors

The compiler will also treat all warnings as errors from now on.
This commit is contained in:
Alexander Söderberg 2020-10-23 10:20:45 +02:00 committed by Alexander Söderberg
parent 6ffee9d04f
commit cfac2639ad
101 changed files with 309 additions and 146 deletions

View file

@ -80,6 +80,7 @@ import java.util.function.Supplier;
* @param <C> Command sender type
* @param <S> Brigadier sender type
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public final class CloudBrigadierManager<C, S> {
private final Map<Class<?>, Pair<Function<? extends ArgumentParser<C, ?>, ? extends ArgumentType<?>>, Boolean>> mappers;
@ -232,7 +233,7 @@ public final class CloudBrigadierManager<C, S> {
final ArgumentParser<C, ?> commandArgument = (ArgumentParser<C, ?>) argument;
final Pair pair = this.mappers.get(GenericTypeReflector.erase(argumentType.getType()));
if (pair == null || pair.getFirst() == null) {
return this.createDefaultMapper(valueType, commandArgument);
return this.createDefaultMapper(valueType);
}
return Pair.of(
(ArgumentType<?>) ((Function) pair.getFirst()).apply(commandArgument),
@ -241,8 +242,7 @@ public final class CloudBrigadierManager<C, S> {
}
private <T, K extends ArgumentParser<C, T>> @NonNull Pair<@NonNull ArgumentType<?>, @NonNull Boolean> createDefaultMapper(
final @NonNull TypeToken<?> clazz,
final @NonNull ArgumentParser<C, T> argument
final @NonNull TypeToken<?> clazz
) {
final Supplier<ArgumentType<?>> argumentTypeSupplier = this.defaultArgumentTypeSuppliers
.get(GenericTypeReflector.erase(clazz.getType()));
@ -278,7 +278,7 @@ public final class CloudBrigadierManager<C, S> {
) {
final CommandTree.Node<CommandArgument<C, ?>> node = this.commandManager
.getCommandTree().getNamedNode(cloudCommand.getArguments().get(0).getName());
final SuggestionProvider<S> provider = (context, builder) -> this.buildSuggestions(node.getValue(), context, builder);
final SuggestionProvider<S> provider = (context, builder) -> this.buildSuggestions(node.getValue(), builder);
final LiteralArgumentBuilder<S> literalArgumentBuilder = LiteralArgumentBuilder
.<S>literal(label)
.requires(sender -> permissionChecker.test(sender, (CommandPermission) node.getNodeMeta()
@ -375,7 +375,7 @@ public final class CloudBrigadierManager<C, S> {
));
argumentBuilders[i] = fragmentBuilder;
if (forceExecutor || (i == parsers.length - 1) && (root.isLeaf() || !root.getValue().isRequired())) {
if (forceExecutor || ((i == parsers.length - 1) && (root.isLeaf() || !root.getValue().isRequired()))) {
fragmentBuilder.executes(executor);
}
@ -410,7 +410,7 @@ public final class CloudBrigadierManager<C, S> {
final SuggestionProvider<S> provider = pair.getSecond()
? null
: (context, builder) -> this.buildSuggestions(root.getValue(),
context, builder
builder
);
argumentBuilder = RequiredArgumentBuilder
.<S, Object>argument(root.getValue().getName(), (ArgumentType<Object>) pair.getFirst())
@ -438,7 +438,6 @@ public final class CloudBrigadierManager<C, S> {
private @NonNull CompletableFuture<Suggestions> buildSuggestions(
final @NonNull CommandArgument<C, ?> argument,
final com.mojang.brigadier.context.@NonNull CommandContext<S> s,
final @NonNull SuggestionsBuilder builder
) {
final CommandContext<C> commandContext = this.dummyContextProvider.get();

View file

@ -4,4 +4,6 @@ dependencies {
api project(':cloud-tasks')
compileOnly "org.bukkit:bukkit:${vers['bukkit']}"
compileOnly "me.lucko:commodore:${vers['commodore']}"
compileOnly "org.jetbrains:annotations:${vers['jb-annotations']}"
compileOnly "com.google.guava:guava:${vers['guava']}"
}

View file

@ -45,6 +45,7 @@ import java.util.logging.Level;
*
* @param <C> Command sender type
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public final class BukkitBrigadierMapper<C> {
private static final int UUID_ARGUMENT_VERSION = 16;
@ -115,6 +116,7 @@ public final class BukkitBrigadierMapper<C> {
};
}
@SuppressWarnings("UnnecessaryLambda")
private Supplier<ArgumentType<?>> getArgumentVec3() {
return () -> {
try {
@ -152,7 +154,7 @@ public final class BukkitBrigadierMapper<C> {
try {
this.brigadierManager.registerDefaultArgumentTypeSupplier(type, () -> {
try {
return (ArgumentType<?>) constructor.newInstance();
return constructor.newInstance();
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}

View file

@ -88,7 +88,7 @@ final class BukkitCommand<C> extends org.bukkit.command.Command implements Plugi
sender,
builder.toString()
)
.whenComplete(((commandResult, throwable) -> {
.whenComplete((commandResult, throwable) -> {
if (throwable != null) {
if (throwable instanceof CompletionException) {
throwable = throwable.getCause();
@ -138,7 +138,7 @@ final class BukkitCommand<C> extends org.bukkit.command.Command implements Plugi
throwable.printStackTrace();
}
}
}));
});
return true;
}

View file

@ -79,7 +79,6 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
private final Function<CommandSender, C> commandSenderMapper;
private final Function<C, CommandSender> backwardsCommandSenderMapper;
private final BukkitSynchronizer bukkitSynchronizer;
private final TaskFactory taskFactory;
private boolean splitAliases = false;
@ -109,6 +108,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link CommandSender}
* @throws Exception If the construction of the manager fails
*/
@SuppressWarnings("unchecked")
public BukkitCommandManager(
final @NonNull Plugin owningPlugin,
final @NonNull Function<@NonNull CommandTree<C>,
@ -123,8 +123,8 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
this.commandSenderMapper = commandSenderMapper;
this.backwardsCommandSenderMapper = backwardsCommandSenderMapper;
this.bukkitSynchronizer = new BukkitSynchronizer(owningPlugin);
this.taskFactory = new TaskFactory(this.bukkitSynchronizer);
final BukkitSynchronizer bukkitSynchronizer = new BukkitSynchronizer(owningPlugin);
this.taskFactory = new TaskFactory(bukkitSynchronizer);
/* Try to determine the Minecraft version */
int version = -1;
@ -148,6 +148,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
Class.forName("com.destroystokyo.paper.PaperConfig");
paper = true;
} catch (final Exception ignored) {
// This is fine
}
this.paper = paper;
@ -183,7 +184,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
this.owningPlugin
);
this.registerDefaultCaptions(new BukkitCaptionRegistryFactory<C>().create());
this.setCaptionRegistry(new BukkitCaptionRegistryFactory<C>().create());
}
/**
@ -363,6 +364,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
public static final class BrigadierFailureException extends IllegalStateException {
private static final long serialVersionUID = 7816660840063155703L;
private final BrigadierFailureReason reason;
/**

View file

@ -31,7 +31,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
* Command preprocessor which decorates incoming {@link cloud.commandframework.context.CommandContext}
* with Bukkit specific objects
*
* @param <C>
* @param <C> Command sender type
*/
final class BukkitCommandPreprocessor<C> implements CommandPreprocessor<C> {

View file

@ -29,7 +29,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Command sender that proxies {@link org.bukkit.command.CommandSender}
* {@inheritDoc}
*/
public abstract class BukkitCommandSender {
@ -40,7 +39,7 @@ public abstract class BukkitCommandSender {
*
* @param internalSender Bukkit command sender
*/
public BukkitCommandSender(final org.bukkit.command.@NonNull CommandSender internalSender) {
protected BukkitCommandSender(final org.bukkit.command.@NonNull CommandSender internalSender) {
this.internalSender = internalSender;
}

View file

@ -61,7 +61,7 @@ public class BukkitPluginRegistrationHandler<C> implements CommandRegistrationHa
this.commandMap = (CommandMap) getCommandMap.invoke(Bukkit.getServer());
final Field knownCommands = SimpleCommandMap.class.getDeclaredField("knownCommands");
knownCommands.setAccessible(true);
@SuppressWarnings("ALL") final Map<String, org.bukkit.command.Command> bukkitCommands =
@SuppressWarnings("unchecked") final Map<String, org.bukkit.command.Command> bukkitCommands =
(Map<String, org.bukkit.command.Command>) knownCommands.get(commandMap);
this.bukkitCommands = bukkitCommands;
this.bukkitCommandManager = bukkitCommandManager;
@ -83,7 +83,7 @@ public class BukkitPluginRegistrationHandler<C> implements CommandRegistrationHa
@SuppressWarnings("unchecked") final BukkitCommand<C> bukkitCommand = new BukkitCommand<>(
label,
(this.bukkitCommandManager.getSplitAliases() ? Collections.<String>emptyList() : aliases),
(this.bukkitCommandManager.getSplitAliases() ? Collections.emptyList() : aliases),
(Command<C>) command,
(CommandArgument<C, ?>) commandArgument,
this.bukkitCommandManager

View file

@ -38,7 +38,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Collections;
@SuppressWarnings("ALL")
@SuppressWarnings({"unchecked", "rawtypes"})
class CloudCommodoreManager<C> extends BukkitPluginRegistrationHandler<C> {
private final BukkitCommandManager<C> commandManager;
@ -77,7 +77,7 @@ class CloudCommodoreManager<C> extends BukkitPluginRegistrationHandler<C> {
) {
final com.mojang.brigadier.Command<?> cmd = o -> 1;
final LiteralCommandNode<?> literalCommandNode = this.brigadierManager
.<Object>createLiteralCommandNode(label, command, (o, p) -> {
.createLiteralCommandNode(label, command, (o, p) -> {
final CommandSender sender = this.commodore.getBukkitSender(o);
return this.commandManager.hasPermission(
this.commandManager.getCommandSenderMapper().apply(sender),

View file

@ -43,7 +43,7 @@ public abstract class EntitySelector {
* @param selector The input string used to create this selector
* @param entities The List of Bukkit {@link Entity entities} to construct the {@link EntitySelector} from
*/
public EntitySelector(
protected EntitySelector(
final @NonNull String selector,
final @NonNull List<@NonNull Entity> entities
) {

View file

@ -108,7 +108,7 @@ public class EnchantmentArgument<C> extends CommandArgument<C, Enchantment> {
public static final class Builder<C> extends CommandArgument.Builder<C, Enchantment> {
protected Builder(final @NonNull String name) {
private Builder(final @NonNull String name) {
super(Enchantment.class, name);
}
@ -127,6 +127,7 @@ public class EnchantmentArgument<C> extends CommandArgument<C, Enchantment> {
public static final class EnchantmentParser<C> implements ArgumentParser<C, Enchantment> {
@Override
@SuppressWarnings("deprecation")
public @NonNull ArgumentParseResult<Enchantment> parse(
final @NonNull CommandContext<C> commandContext,
final @NonNull Queue<@NonNull String> inputQueue
@ -142,7 +143,6 @@ public class EnchantmentArgument<C> extends CommandArgument<C, Enchantment> {
final NamespacedKey key;
if (input.contains(":")) {
final String[] splitInput = input.split(":");
//noinspection deprecation
key = new NamespacedKey(splitInput[0], splitInput[1]);
} else {
key = NamespacedKey.minecraft(input);
@ -177,6 +177,7 @@ public class EnchantmentArgument<C> extends CommandArgument<C, Enchantment> {
public static final class EnchantmentParseException extends ParserException {
private static final long serialVersionUID = 1415174766296065151L;
private final String input;
/**

View file

@ -107,7 +107,7 @@ public class MaterialArgument<C> extends CommandArgument<C, Material> {
public static final class Builder<C> extends CommandArgument.Builder<C, Material> {
protected Builder(final @NonNull String name) {
private Builder(final @NonNull String name) {
super(Material.class, name);
}
@ -164,6 +164,7 @@ public class MaterialArgument<C> extends CommandArgument<C, Material> {
public static final class MaterialParseException extends ParserException {
private static final long serialVersionUID = 1615554107385965610L;
private final String input;
/**

View file

@ -114,7 +114,7 @@ public final class OfflinePlayerArgument<C> extends CommandArgument<C, OfflinePl
public static final class Builder<C> extends CommandArgument.Builder<C, OfflinePlayer> {
protected Builder(final @NonNull String name) {
private Builder(final @NonNull String name) {
super(OfflinePlayer.class, name);
}
@ -136,6 +136,7 @@ public final class OfflinePlayerArgument<C> extends CommandArgument<C, OfflinePl
public static final class OfflinePlayerParser<C> implements ArgumentParser<C, OfflinePlayer> {
@Override
@SuppressWarnings("deprecation")
public @NonNull ArgumentParseResult<OfflinePlayer> parse(
final @NonNull CommandContext<C> commandContext,
final @NonNull Queue<String> inputQueue
@ -149,10 +150,9 @@ public final class OfflinePlayerArgument<C> extends CommandArgument<C, OfflinePl
}
inputQueue.remove();
//noinspection deprecation
OfflinePlayer player = Bukkit.getOfflinePlayer(input);
final OfflinePlayer player = Bukkit.getOfflinePlayer(input);
if (player == null || (!player.hasPlayedBefore() && !player.isOnline())) {
if (!player.hasPlayedBefore() && !player.isOnline()) {
return ArgumentParseResult.failure(new OfflinePlayerParseException(input, commandContext));
}
@ -181,6 +181,7 @@ public final class OfflinePlayerArgument<C> extends CommandArgument<C, OfflinePl
*/
public static final class OfflinePlayerParseException extends ParserException {
private static final long serialVersionUID = 7632293268451349508L;
private final String input;
/**

View file

@ -110,7 +110,7 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
public static final class Builder<C> extends CommandArgument.Builder<C, Player> {
protected Builder(final @NonNull String name) {
private Builder(final @NonNull String name) {
super(Player.class, name);
}
@ -130,6 +130,7 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
public static final class PlayerParser<C> implements ArgumentParser<C, Player> {
@Override
@SuppressWarnings("deprecation")
public @NonNull ArgumentParseResult<Player> parse(
final @NonNull CommandContext<C> commandContext,
final @NonNull Queue<@NonNull String> inputQueue
@ -143,7 +144,6 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
}
inputQueue.remove();
//noinspection deprecation
Player player = Bukkit.getPlayer(input);
if (player == null) {
@ -175,6 +175,7 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
*/
public static final class PlayerParseException extends ParserException {
private static final long serialVersionUID = 927476591631527552L;
private final String input;
/**

View file

@ -108,7 +108,7 @@ public class WorldArgument<C> extends CommandArgument<C, World> {
public static final class Builder<C> extends CommandArgument.Builder<C, World> {
protected Builder(final @NonNull String name) {
private Builder(final @NonNull String name) {
super(World.class, name);
}
@ -154,6 +154,7 @@ public class WorldArgument<C> extends CommandArgument<C, World> {
public static final class WorldParseException extends ParserException {
private static final long serialVersionUID = 561648144491587450L;
private final String input;
/**

View file

@ -289,6 +289,8 @@ public final class LocationArgument<C> extends CommandArgument<C, Location> {
private static class LocationParseException extends ParserException {
private static final long serialVersionUID = -3261835227265878218L;
protected LocationParseException(
final @NonNull CommandContext<?> context,
final @NonNull String input

View file

@ -105,7 +105,7 @@ public final class MultipleEntitySelectorArgument<C> extends CommandArgument<C,
public static final class Builder<C> extends CommandArgument.Builder<C, MultipleEntitySelector> {
protected Builder(final @NonNull String name) {
private Builder(final @NonNull String name) {
super(MultipleEntitySelector.class, name);
}

View file

@ -109,7 +109,7 @@ public final class MultiplePlayerSelectorArgument<C> extends CommandArgument<C,
public static final class Builder<C> extends CommandArgument.Builder<C, MultiplePlayerSelector> {
protected Builder(final @NonNull String name) {
private Builder(final @NonNull String name) {
super(MultiplePlayerSelector.class, name);
}

View file

@ -35,6 +35,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
*/
public final class SelectorParseException extends ParserException {
private static final long serialVersionUID = 1900826717897819065L;
private final String input;
/**

View file

@ -103,7 +103,7 @@ public final class SingleEntitySelectorArgument<C> extends CommandArgument<C, Si
public static final class Builder<C> extends CommandArgument.Builder<C, SingleEntitySelector> {
protected Builder(final @NonNull String name) {
private Builder(final @NonNull String name) {
super(SingleEntitySelector.class, name);
}

View file

@ -107,7 +107,7 @@ public final class SinglePlayerSelectorArgument<C> extends CommandArgument<C, Si
public static final class Builder<C> extends CommandArgument.Builder<C, SinglePlayerSelector> {
protected Builder(final @NonNull String name) {
private Builder(final @NonNull String name) {
super(SinglePlayerSelector.class, name);
}

View file

@ -48,7 +48,6 @@ public final class BungeeCommand<C> extends Command implements TabExecutor {
private final BungeeCommandManager<C> manager;
private final CommandArgument<C, ?> command;
private final cloud.commandframework.Command<C> cloudCommand;
@SuppressWarnings("unchecked")
BungeeCommand(
@ -63,7 +62,6 @@ public final class BungeeCommand<C> extends Command implements TabExecutor {
);
this.command = command;
this.manager = manager;
this.cloudCommand = cloudCommand;
}
@Override
@ -78,7 +76,7 @@ public final class BungeeCommand<C> extends Command implements TabExecutor {
sender,
builder.toString()
)
.whenComplete(((commandResult, throwable) -> {
.whenComplete((commandResult, throwable) -> {
if (throwable != null) {
if (throwable instanceof CompletionException) {
throwable = throwable.getCause();
@ -154,7 +152,7 @@ public final class BungeeCommand<C> extends Command implements TabExecutor {
throwable.printStackTrace();
}
}
}));
});
}
@Override

View file

@ -63,6 +63,7 @@ public class BungeeCommandManager<C> extends CommandManager<C> {
* @param commandSenderMapper Function that maps {@link CommandSender} to the command sender type
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link CommandSender}
*/
@SuppressWarnings("unchecked")
public BungeeCommandManager(
final @NonNull Plugin owningPlugin,
final @NonNull Function<@NonNull CommandTree<C>,

View file

@ -31,7 +31,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
* Command preprocessor which decorates incoming {@link cloud.commandframework.context.CommandContext}
* with Bungee specific objects
*
* @param <C>
* @param <C> Command sender type
* @since 1.1.0
*/
final class BungeeCommandPreprocessor<C> implements CommandPreprocessor<C> {

View file

@ -184,6 +184,8 @@ public final class PlayerArgument<C> extends CommandArgument<C, ProxiedPlayer> {
public static final class PlayerParseException extends ParserException {
private static final long serialVersionUID = -2685136673577959929L;
private PlayerParseException(
final @NonNull String input,
final @NonNull CommandContext<?> context

View file

@ -172,6 +172,8 @@ public final class ServerArgument<C> extends CommandArgument<C, ServerInfo> {
public static final class ServerParseException extends ParserException {
private static final long serialVersionUID = -3825941611365494659L;
private ServerParseException(
final @NonNull String input,
final @NonNull CommandContext<?> context

View file

@ -48,7 +48,6 @@ final class CloudburstCommand<C> extends PluginCommand<Plugin> {
private final CommandArgument<C, ?> command;
private final CloudburstCommandManager<C> manager;
private final Command<C> cloudCommand;
CloudburstCommand(
final @NonNull String label,
@ -64,7 +63,6 @@ final class CloudburstCommand<C> extends PluginCommand<Plugin> {
.build());
this.command = command;
this.manager = manager;
this.cloudCommand = cloudCommand;
}
@Override
@ -83,7 +81,7 @@ final class CloudburstCommand<C> extends PluginCommand<Plugin> {
sender,
builder.toString()
)
.whenComplete(((commandResult, throwable) -> {
.whenComplete((commandResult, throwable) -> {
if (throwable != null) {
if (throwable instanceof CompletionException) {
throwable = throwable.getCause();
@ -131,7 +129,7 @@ final class CloudburstCommand<C> extends PluginCommand<Plugin> {
throwable.printStackTrace();
}
}
}));
});
return true;
}

View file

@ -54,6 +54,7 @@ public class CloudburstCommandManager<C> extends CommandManager<C> {
* @param commandSenderMapper Function that maps {@link CommandSender} to the command sender type
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link CommandSender}
*/
@SuppressWarnings("unchecked")
public CloudburstCommandManager(
final @NonNull Plugin owningPlugin,
final @NonNull Function<@NonNull CommandTree<C>,

View file

@ -48,6 +48,7 @@ class CloudburstPluginRegistrationHandler<C> implements CommandRegistrationHandl
}
@Override
@SuppressWarnings("unchecked")
public final boolean registerCommand(final @NonNull Command<?> command) {
/* We only care about the root command argument */
final CommandArgument<?, ?> commandArgument = command.getArguments().get(0);

View file

@ -588,6 +588,8 @@ public final class MinecraftHelp<C> {
}
/**
* Get the configured primary color
*
* @return The primary color for the color scheme
*/
public @NonNull TextColor primary() {
@ -595,6 +597,8 @@ public final class MinecraftHelp<C> {
}
/**
* Get the configured highlight color
*
* @return The primary color used to highlight commands and queries
*/
public @NonNull TextColor highlight() {
@ -602,6 +606,8 @@ public final class MinecraftHelp<C> {
}
/**
* Get the configured alternate highlight color
*
* @return The secondary color used to highlight commands and queries
*/
public @NonNull TextColor alternateHighlight() {
@ -609,6 +615,8 @@ public final class MinecraftHelp<C> {
}
/**
* Get the configured text color
*
* @return The color used for description text
*/
public @NonNull TextColor text() {
@ -616,6 +624,8 @@ public final class MinecraftHelp<C> {
}
/**
* Get the configured accent color
*
* @return The color used for accents and symbols
*/
public @NonNull TextColor accent() {
@ -623,6 +633,8 @@ public final class MinecraftHelp<C> {
}
/**
* Create a new {@link HelpColors} instance
*
* @param primary The primary color for the color scheme
* @param highlight The primary color used to highlight commands and queries
* @param alternateHighlight The secondary color used to highlight commands and queries

View file

@ -50,7 +50,7 @@ final class Pagination<T> {
this.outOfRangeRenderer = outOfRangeRenderer;
}
public @NonNull List<Component> render(
@NonNull List<Component> render(
final @NonNull List<T> content,
final int page,
final int itemsPerPage
@ -73,7 +73,7 @@ final class Pagination<T> {
renderedContent.add(this.footerRenderer.apply(page, pages));
return renderedContent;
return Collections.unmodifiableList(renderedContent);
}
}

View file

@ -218,6 +218,8 @@ public final class TextColorArgument<C> extends CommandArgument<C, TextColor> {
private static final class TextColorParseException extends ParserException {
private static final long serialVersionUID = -6236625328843879518L;
private TextColorParseException(
final @NonNull CommandContext<?> commandContext,
final @NonNull String input

View file

@ -2,4 +2,6 @@ dependencies {
api project(':cloud-bukkit')
compileOnly "com.destroystokyo.paper:paper-api:${vers['paper-api']}"
compileOnly "com.destroystokyo.paper:paper-mojangapi:${vers['paper-api']}"
compileOnly "org.jetbrains:annotations:${vers['jb-annotations']}"
compileOnly "com.google.guava:guava:${vers['guava']}"
}

View file

@ -30,7 +30,6 @@ import cloud.commandframework.bukkit.BukkitBrigadierMapper;
import cloud.commandframework.context.CommandContext;
import cloud.commandframework.permission.CommandPermission;
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource;
import com.destroystokyo.paper.event.brigadier.CommandRegisteredEvent;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginIdentifiableCommand;
import org.bukkit.event.EventHandler;
@ -60,7 +59,8 @@ class PaperBrigadierListener<C> implements Listener {
@EventHandler
@SuppressWarnings("deprecation")
public void onCommandRegister(final @NonNull CommandRegisteredEvent<BukkitBrigadierCommandSource> event) {
public void onCommandRegister(final com.destroystokyo.paper.event.brigadier
.@NonNull CommandRegisteredEvent<BukkitBrigadierCommandSource> event) {
if (!(event.getCommand() instanceof PluginIdentifiableCommand)) {
return;
} else if (!((PluginIdentifiableCommand) event.getCommand())

View file

@ -68,6 +68,7 @@ public final class CloudInjectionModule<C> extends AbstractModule {
}
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
protected void configure() {
final Type commandTreeType = Types.newParameterizedType(CommandTree.class, this.commandSenderType);
final Type commandExecutionCoordinatorType = Types.newParameterizedType(CommandExecutionCoordinator.class,

View file

@ -77,6 +77,7 @@ public class VelocityCommandManager<C> extends CommandManager<C> {
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link CommandSource}
*/
@Inject
@SuppressWarnings("unchecked")
public VelocityCommandManager(
final @NonNull ProxyServer proxyServer,
final @NonNull Function<@NonNull CommandTree<C>, @NonNull CommandExecutionCoordinator<C>> commandExecutionCoordinator,

View file

@ -31,7 +31,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
* Command preprocessor which decorates incoming {@link cloud.commandframework.context.CommandContext}
* with Velocity specific objects
*
* @param <C>
* @param <C> Command sender type
* @since 1.1.0
*/
final class VelocityCommandPreprocessor<C> implements CommandPreprocessor<C> {

View file

@ -55,6 +55,7 @@ final class VelocityPluginRegistrationHandler<C> implements CommandRegistrationH
}
@Override
@SuppressWarnings("unchecked")
public boolean registerCommand(final @NonNull Command<?> command) {
final CommandArgument<?, ?> argument = command.getArguments().get(0);
final List<String> aliases = ((StaticArgument<C>) argument).getAlternativeAliases();

View file

@ -179,6 +179,8 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
public static final class PlayerParseException extends ParserException {
private static final long serialVersionUID = -4839583631837040297L;
private PlayerParseException(
final @NonNull String input,
final @NonNull CommandContext<?> context

View file

@ -172,6 +172,8 @@ public final class ServerArgument<C> extends CommandArgument<C, RegisteredServer
public static final class ServerParseException extends ParserException {
private static final long serialVersionUID = 9168156226853233788L;
private ServerParseException(
final @NonNull String input,
final @NonNull CommandContext<?> context