✨ Add errorprone and fix warnings/errors
The compiler will also treat all warnings as errors from now on.
This commit is contained in:
parent
6ffee9d04f
commit
cfac2639ad
101 changed files with 309 additions and 146 deletions
|
|
@ -46,19 +46,17 @@ public class JavacordCommand<C> implements MessageCreateListener {
|
|||
|
||||
private final JavacordCommandManager<C> manager;
|
||||
private final CommandArgument<C, ?> command;
|
||||
private final cloud.commandframework.Command<C> cloudCommand;
|
||||
|
||||
JavacordCommand(
|
||||
final cloud.commandframework.@NonNull Command<C> cloudCommand,
|
||||
final @NonNull CommandArgument<C, ?> command,
|
||||
final @NonNull JavacordCommandManager<C> manager
|
||||
) {
|
||||
this.command = command;
|
||||
this.manager = manager;
|
||||
this.cloudCommand = cloudCommand;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public final void onMessageCreate(final @NonNull MessageCreateEvent event) {
|
||||
MessageAuthor messageAuthor = event.getMessageAuthor();
|
||||
|
||||
|
|
@ -85,7 +83,6 @@ public class JavacordCommand<C> implements MessageCreateListener {
|
|||
messageContent = messageContent.replaceFirst(commandPrefix, "");
|
||||
|
||||
final String finalContent = messageContent;
|
||||
//noinspection unchecked
|
||||
if (((StaticArgument<C>) command).getAliases()
|
||||
.stream()
|
||||
.map(String::toLowerCase)
|
||||
|
|
@ -94,7 +91,7 @@ public class JavacordCommand<C> implements MessageCreateListener {
|
|||
}
|
||||
|
||||
manager.executeCommand(sender, finalContent)
|
||||
.whenComplete(((commandResult, throwable) -> {
|
||||
.whenComplete((commandResult, throwable) -> {
|
||||
if (throwable == null) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -158,7 +155,7 @@ public class JavacordCommand<C> implements MessageCreateListener {
|
|||
|
||||
commandSender.sendErrorMessage(throwable.getMessage());
|
||||
throwable.printStackTrace();
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ public class JavacordCommandManager<C> extends CommandManager<C> {
|
|||
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link Object}
|
||||
* @param commandPrefixMapper Function that maps the command sender type to the command prefix
|
||||
* @param commandPermissionMapper Function used to check if a command sender has the permission to execute a command
|
||||
* @throws Exception If the construction of the manager fails
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public JavacordCommandManager(
|
||||
final @NonNull DiscordApi discordApi,
|
||||
final @NonNull Function<@NonNull CommandTree<C>,
|
||||
|
|
@ -69,8 +69,7 @@ public class JavacordCommandManager<C> extends CommandManager<C> {
|
|||
final @NonNull Function<@NonNull C, @NonNull String> commandPrefixMapper,
|
||||
final @Nullable BiFunction<@NonNull C,
|
||||
@NonNull String, @NonNull Boolean> commandPermissionMapper
|
||||
)
|
||||
throws Exception {
|
||||
) {
|
||||
super(commandExecutionCoordinator, new JavacordRegistrationHandler<>());
|
||||
((JavacordRegistrationHandler<C>) this.getCommandRegistrationHandler()).initialize(this);
|
||||
this.discordApi = discordApi;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ final class JavacordRegistrationHandler<C> implements CommandRegistrationHandler
|
|||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked") final JavacordCommand<C> javacordCommand = new JavacordCommand<>(
|
||||
(Command<C>) command,
|
||||
(CommandArgument<C, ?>) commandArgument,
|
||||
this.javacordCommandManager
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue