Fix code style issues in jda
This commit is contained in:
parent
c5873e46e6
commit
f3abbf5958
6 changed files with 30 additions and 13 deletions
|
|
@ -47,7 +47,14 @@ public class JDA4CommandManager<C> extends JDACommandManager<C> {
|
||||||
* @param jda JDA instance to register against
|
* @param jda JDA instance to register against
|
||||||
* @param prefixMapper Function that maps the sender to a command prefix string
|
* @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 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 commandSenderMapper Function that maps {@link JDACommandSender} to the command sender type
|
||||||
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link JDACommandSender}
|
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link JDACommandSender}
|
||||||
* @throws InterruptedException If the jda instance does not ready correctly
|
* @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
|
final @NonNull Function<@NonNull C, @NonNull JDACommandSender> backwardsCommandSenderMapper
|
||||||
)
|
)
|
||||||
throws InterruptedException {
|
throws InterruptedException {
|
||||||
super(jda,
|
super(
|
||||||
|
jda,
|
||||||
prefixMapper,
|
prefixMapper,
|
||||||
permissionMapper,
|
permissionMapper,
|
||||||
commandExecutionCoordinator,
|
commandExecutionCoordinator,
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,14 @@ public class JDACommandManager<C> extends CommandManager<C> {
|
||||||
* @param jda JDA instance to register against
|
* @param jda JDA instance to register against
|
||||||
* @param prefixMapper Function that maps the sender to a command prefix string
|
* @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 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 commandSenderMapper Function that maps {@link MessageReceivedEvent} to the command sender type
|
||||||
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link MessageReceivedEvent}
|
* @param backwardsCommandSenderMapper Function that maps the command sender type to {@link MessageReceivedEvent}
|
||||||
* @throws InterruptedException If the jda instance does not ready correctly
|
* @throws InterruptedException If the jda instance does not ready correctly
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ final class JDACommandPreprocessor<C> implements CommandPreprocessor<C> {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(final @NonNull CommandPreprocessingContext<C> context) {
|
public void accept(final @NonNull CommandPreprocessingContext<C> context) {
|
||||||
context.getCommandContext().store("JDA", mgr.getJDA());
|
context.getCommandContext().store("JDA", this.mgr.getJDA());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public class JDACommandSender {
|
||||||
* @param event Message Received Event
|
* @param event Message Received Event
|
||||||
* @return Constructed JDA Command Sender
|
* @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)) {
|
if (event.isFromType(ChannelType.PRIVATE)) {
|
||||||
return new JDAPrivateSender(event, event.getAuthor(), event.getPrivateChannel());
|
return new JDAPrivateSender(event, event.getAuthor(), event.getPrivateChannel());
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +79,7 @@ public class JDACommandSender {
|
||||||
* @return Optional of the message receive event
|
* @return Optional of the message receive event
|
||||||
*/
|
*/
|
||||||
public final @NonNull Optional<MessageReceivedEvent> getEvent() {
|
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
|
* @return User that sent the message
|
||||||
*/
|
*/
|
||||||
public final @NonNull User getUser() {
|
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
|
* @return Channel that the message was sent in
|
||||||
*/
|
*/
|
||||||
public final @NonNull MessageChannel getChannel() {
|
public final @NonNull MessageChannel getChannel() {
|
||||||
return channel;
|
return this.channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class JDAGuildSender extends JDACommandSender {
|
||||||
* @return Member that sent the message
|
* @return Member that sent the message
|
||||||
*/
|
*/
|
||||||
public @NonNull Member getMember() {
|
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
|
* @return Channel that the message was sent in
|
||||||
*/
|
*/
|
||||||
public @NonNull TextChannel getTextChannel() {
|
public @NonNull TextChannel getTextChannel() {
|
||||||
return channel;
|
return this.channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,9 @@ public class JDAPrivateSender extends JDACommandSender {
|
||||||
* @param channel Channel sent in
|
* @param channel Channel sent in
|
||||||
*/
|
*/
|
||||||
public JDAPrivateSender(
|
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);
|
super(event, user, channel);
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
|
|
@ -55,8 +57,8 @@ public class JDAPrivateSender extends JDACommandSender {
|
||||||
*
|
*
|
||||||
* @return Channel that the message was sent in
|
* @return Channel that the message was sent in
|
||||||
*/
|
*/
|
||||||
public PrivateChannel getPrivateChannel() {
|
public @NonNull PrivateChannel getPrivateChannel() {
|
||||||
return channel;
|
return this.channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue