Fix code style issues in jda

This commit is contained in:
broccolai 2020-10-21 18:58:31 +01:00 committed by Alexander Söderberg
parent c5873e46e6
commit f3abbf5958
6 changed files with 30 additions and 13 deletions

View file

@ -47,7 +47,14 @@ public class JDA4CommandManager<C> extends JDACommandManager<C> {
* @param jda JDA instance to register against
* @param prefixMapper Function that maps the sender to a command prefix string
* @param permissionMapper Function used to check if a command sender has the permission to execute a command
* @param commandExecutionCoordinator Coordination provider
* @param commandExecutionCoordinator Execution coordinator instance. The coordinator is in charge of executing incoming
* commands. Some considerations must be made when picking a suitable execution coordinator
* for your platform. For example, an entirely asynchronous coordinator is not suitable
* when the parsers used in that particular platform are not thread safe. If you have
* commands that perform blocking operations, however, it might not be a good idea to
* use a synchronous execution coordinator. In most cases you will want to pick between
* {@link CommandExecutionCoordinator#simpleCoordinator()} and
* {@link cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator}
* @param commandSenderMapper Function that maps {@link JDACommandSender} to the command sender type
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link JDACommandSender}
* @throws InterruptedException If the jda instance does not ready correctly
@ -61,7 +68,8 @@ public class JDA4CommandManager<C> extends JDACommandManager<C> {
final @NonNull Function<@NonNull C, @NonNull JDACommandSender> backwardsCommandSenderMapper
)
throws InterruptedException {
super(jda,
super(
jda,
prefixMapper,
permissionMapper,
commandExecutionCoordinator,

View file

@ -61,7 +61,14 @@ public class JDACommandManager<C> extends CommandManager<C> {
* @param jda JDA instance to register against
* @param prefixMapper Function that maps the sender to a command prefix string
* @param permissionMapper Function used to check if a command sender has the permission to execute a command
* @param commandExecutionCoordinator Coordination provider
* @param commandExecutionCoordinator Execution coordinator instance. The coordinator is in charge of executing incoming
* commands. Some considerations must be made when picking a suitable execution coordinator
* for your platform. For example, an entirely asynchronous coordinator is not suitable
* when the parsers used in that particular platform are not thread safe. If you have
* commands that perform blocking operations, however, it might not be a good idea to
* use a synchronous execution coordinator. In most cases you will want to pick between
* {@link CommandExecutionCoordinator#simpleCoordinator()} and
* {@link cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator}
* @param commandSenderMapper Function that maps {@link MessageReceivedEvent} to the command sender type
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link MessageReceivedEvent}
* @throws InterruptedException If the jda instance does not ready correctly

View file

@ -51,7 +51,7 @@ final class JDACommandPreprocessor<C> implements CommandPreprocessor<C> {
*/
@Override
public void accept(final @NonNull CommandPreprocessingContext<C> context) {
context.getCommandContext().store("JDA", mgr.getJDA());
context.getCommandContext().store("JDA", this.mgr.getJDA());
}
}

View file

@ -65,7 +65,7 @@ public class JDACommandSender {
* @param event Message Received Event
* @return Constructed JDA Command Sender
*/
public static JDACommandSender of(final @NonNull MessageReceivedEvent event) {
public static @NonNull JDACommandSender of(final @NonNull MessageReceivedEvent event) {
if (event.isFromType(ChannelType.PRIVATE)) {
return new JDAPrivateSender(event, event.getAuthor(), event.getPrivateChannel());
}
@ -79,7 +79,7 @@ public class JDACommandSender {
* @return Optional of the message receive event
*/
public final @NonNull Optional<MessageReceivedEvent> getEvent() {
return Optional.ofNullable(event);
return Optional.ofNullable(this.event);
}
/**
@ -88,7 +88,7 @@ public class JDACommandSender {
* @return User that sent the message
*/
public final @NonNull User getUser() {
return user;
return this.user;
}
/**
@ -97,7 +97,7 @@ public class JDACommandSender {
* @return Channel that the message was sent in
*/
public final @NonNull MessageChannel getChannel() {
return channel;
return this.channel;
}
}

View file

@ -60,7 +60,7 @@ public class JDAGuildSender extends JDACommandSender {
* @return Member that sent the message
*/
public @NonNull Member getMember() {
return member;
return this.member;
}
/**
@ -69,7 +69,7 @@ public class JDAGuildSender extends JDACommandSender {
* @return Channel that the message was sent in
*/
public @NonNull TextChannel getTextChannel() {
return channel;
return this.channel;
}
}

View file

@ -44,7 +44,9 @@ public class JDAPrivateSender extends JDACommandSender {
* @param channel Channel sent in
*/
public JDAPrivateSender(
final @Nullable MessageReceivedEvent event, final @NonNull User user, final @NonNull PrivateChannel channel
final @Nullable MessageReceivedEvent event,
final @NonNull User user,
final @NonNull PrivateChannel channel
) {
super(event, user, channel);
this.channel = channel;
@ -55,8 +57,8 @@ public class JDAPrivateSender extends JDACommandSender {
*
* @return Channel that the message was sent in
*/
public PrivateChannel getPrivateChannel() {
return channel;
public @NonNull PrivateChannel getPrivateChannel() {
return this.channel;
}
}