Add explict this checkstyle rule and fix violations
This commit is contained in:
parent
a6eb44376c
commit
d5259dfbe4
62 changed files with 195 additions and 192 deletions
|
|
@ -75,24 +75,24 @@ public class JavacordCommand<C> implements MessageCreateListener {
|
|||
commandSender = new JavacordCommandSender(event);
|
||||
}
|
||||
|
||||
C sender = manager.getCommandSenderMapper().apply(commandSender);
|
||||
C sender = this.manager.getCommandSenderMapper().apply(commandSender);
|
||||
|
||||
String messageContent = event.getMessageContent();
|
||||
String commandPrefix = manager.getCommandPrefix(sender);
|
||||
String commandPrefix = this.manager.getCommandPrefix(sender);
|
||||
if (!messageContent.startsWith(commandPrefix)) {
|
||||
return;
|
||||
}
|
||||
messageContent = messageContent.replaceFirst(commandPrefix, "");
|
||||
|
||||
final String finalContent = messageContent;
|
||||
if (((StaticArgument<C>) command).getAliases()
|
||||
if (((StaticArgument<C>) this.command).getAliases()
|
||||
.stream()
|
||||
.map(String::toLowerCase)
|
||||
.noneMatch(commandAlias -> finalContent.toLowerCase().startsWith(commandAlias))) {
|
||||
return;
|
||||
}
|
||||
|
||||
manager.executeCommand(sender, finalContent)
|
||||
this.manager.executeCommand(sender, finalContent)
|
||||
.whenComplete((commandResult, throwable) -> {
|
||||
if (throwable == null) {
|
||||
return;
|
||||
|
|
@ -109,7 +109,7 @@ public class JavacordCommand<C> implements MessageCreateListener {
|
|||
}
|
||||
|
||||
if (throwable instanceof InvalidSyntaxException) {
|
||||
manager.handleException(
|
||||
this.manager.handleException(
|
||||
sender,
|
||||
InvalidSyntaxException.class,
|
||||
(InvalidSyntaxException) throwable,
|
||||
|
|
@ -123,7 +123,7 @@ public class JavacordCommand<C> implements MessageCreateListener {
|
|||
}
|
||||
|
||||
if (throwable instanceof InvalidCommandSenderException) {
|
||||
manager.handleException(
|
||||
this.manager.handleException(
|
||||
sender,
|
||||
InvalidCommandSenderException.class,
|
||||
(InvalidCommandSenderException) throwable,
|
||||
|
|
@ -134,7 +134,7 @@ public class JavacordCommand<C> implements MessageCreateListener {
|
|||
}
|
||||
|
||||
if (throwable instanceof NoPermissionException) {
|
||||
manager.handleException(
|
||||
this.manager.handleException(
|
||||
sender,
|
||||
NoPermissionException.class,
|
||||
(NoPermissionException) throwable,
|
||||
|
|
@ -145,7 +145,7 @@ public class JavacordCommand<C> implements MessageCreateListener {
|
|||
}
|
||||
|
||||
if (throwable instanceof ArgumentParseException) {
|
||||
manager.handleException(
|
||||
this.manager.handleException(
|
||||
sender,
|
||||
ArgumentParseException.class,
|
||||
(ArgumentParseException) throwable,
|
||||
|
|
@ -157,7 +157,7 @@ public class JavacordCommand<C> implements MessageCreateListener {
|
|||
}
|
||||
|
||||
if (throwable instanceof CommandExecutionException) {
|
||||
manager.handleException(
|
||||
this.manager.handleException(
|
||||
sender,
|
||||
CommandExecutionException.class,
|
||||
(CommandExecutionException) throwable,
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public class JavacordCommandSender {
|
|||
*/
|
||||
@NonNull
|
||||
public CompletableFuture<Message> sendErrorMessage(final @Nullable String message) {
|
||||
return sendMessage(":x: " + message);
|
||||
return this.sendMessage(":x: " + message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -115,7 +115,7 @@ public class JavacordCommandSender {
|
|||
*/
|
||||
@NonNull
|
||||
public CompletableFuture<Message> sendSuccessMessage(final @Nullable String message) {
|
||||
return sendMessage(":white_check_mark: " + message);
|
||||
return this.sendMessage(":white_check_mark: " + message);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class JDACommandListener<C> extends ListenerAdapter {
|
|||
|
||||
content = content.substring(prefix.length());
|
||||
|
||||
commandManager.executeCommand(sender, content)
|
||||
this.commandManager.executeCommand(sender, content)
|
||||
.whenComplete((commandResult, throwable) -> {
|
||||
if (throwable == null) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ public class JDACommandManager<C> extends CommandManager<C> {
|
|||
* @return JDA instance
|
||||
*/
|
||||
public final @NonNull JDA getJDA() {
|
||||
return jda;
|
||||
return this.jda;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public final class ChannelArgument<C> extends CommandArgument<C, MessageChannel>
|
|||
* @return List of Modes
|
||||
*/
|
||||
public @NotNull Set<ParserMode> getModes() {
|
||||
return modes;
|
||||
return this.modes;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ public final class ChannelArgument<C> extends CommandArgument<C, MessageChannel>
|
|||
*/
|
||||
@Override
|
||||
public @NonNull ChannelArgument<C> build() {
|
||||
return new ChannelArgument<>(this.isRequired(), this.getName(), modes);
|
||||
return new ChannelArgument<>(this.isRequired(), this.getName(), this.modes);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -183,7 +183,7 @@ public final class ChannelArgument<C> extends CommandArgument<C, MessageChannel>
|
|||
return ArgumentParseResult.failure(new IllegalArgumentException("Channel arguments can only be parsed in guilds"));
|
||||
}
|
||||
|
||||
if (modes.contains(ParserMode.MENTION)) {
|
||||
if (this.modes.contains(ParserMode.MENTION)) {
|
||||
if (input.startsWith("<#") && input.endsWith(">")) {
|
||||
final String id = input.substring(2, input.length() - 1);
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ public final class ChannelArgument<C> extends CommandArgument<C, MessageChannel>
|
|||
}
|
||||
}
|
||||
|
||||
if (modes.contains(ParserMode.ID)) {
|
||||
if (this.modes.contains(ParserMode.ID)) {
|
||||
try {
|
||||
final ArgumentParseResult<MessageChannel> result = this.channelFromId(event, input, input);
|
||||
inputQueue.remove();
|
||||
|
|
@ -211,7 +211,7 @@ public final class ChannelArgument<C> extends CommandArgument<C, MessageChannel>
|
|||
}
|
||||
}
|
||||
|
||||
if (modes.contains(ParserMode.NAME)) {
|
||||
if (this.modes.contains(ParserMode.NAME)) {
|
||||
final List<TextChannel> channels = event.getGuild().getTextChannelsByName(input, true);
|
||||
|
||||
if (channels.size() == 0) {
|
||||
|
|
@ -271,7 +271,7 @@ public final class ChannelArgument<C> extends CommandArgument<C, MessageChannel>
|
|||
* @return users input
|
||||
*/
|
||||
public final @NonNull String getInput() {
|
||||
return input;
|
||||
return this.input;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public final class RoleArgument<C> extends CommandArgument<C, Role> {
|
|||
* @return List of Modes
|
||||
*/
|
||||
public @NotNull Set<ParserMode> getModes() {
|
||||
return modes;
|
||||
return this.modes;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ public final class RoleArgument<C> extends CommandArgument<C, Role> {
|
|||
*/
|
||||
@Override
|
||||
public @NonNull RoleArgument<C> build() {
|
||||
return new RoleArgument<>(this.isRequired(), this.getName(), modes);
|
||||
return new RoleArgument<>(this.isRequired(), this.getName(), this.modes);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -183,7 +183,7 @@ public final class RoleArgument<C> extends CommandArgument<C, Role> {
|
|||
return ArgumentParseResult.failure(new IllegalArgumentException("Role arguments can only be parsed in guilds"));
|
||||
}
|
||||
|
||||
if (modes.contains(ParserMode.MENTION)) {
|
||||
if (this.modes.contains(ParserMode.MENTION)) {
|
||||
if (input.startsWith("<@&") && input.endsWith(">")) {
|
||||
final String id = input.substring(3, input.length() - 1);
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ public final class RoleArgument<C> extends CommandArgument<C, Role> {
|
|||
}
|
||||
}
|
||||
|
||||
if (modes.contains(ParserMode.ID)) {
|
||||
if (this.modes.contains(ParserMode.ID)) {
|
||||
try {
|
||||
final ArgumentParseResult<Role> result = this.roleFromId(event, input, input);
|
||||
inputQueue.remove();
|
||||
|
|
@ -211,7 +211,7 @@ public final class RoleArgument<C> extends CommandArgument<C, Role> {
|
|||
}
|
||||
}
|
||||
|
||||
if (modes.contains(ParserMode.NAME)) {
|
||||
if (this.modes.contains(ParserMode.NAME)) {
|
||||
final List<Role> roles = event.getGuild().getRolesByName(input, true);
|
||||
|
||||
if (roles.size() == 0) {
|
||||
|
|
@ -271,7 +271,7 @@ public final class RoleArgument<C> extends CommandArgument<C, Role> {
|
|||
* @return users input
|
||||
*/
|
||||
public final @NonNull String getInput() {
|
||||
return input;
|
||||
return this.input;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public final class UserArgument<C> extends CommandArgument<C, User> {
|
|||
* @return List of Modes
|
||||
*/
|
||||
public @NotNull Set<ParserMode> getModes() {
|
||||
return modes;
|
||||
return this.modes;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ public final class UserArgument<C> extends CommandArgument<C, User> {
|
|||
*/
|
||||
@Override
|
||||
public @NonNull UserArgument<C> build() {
|
||||
return new UserArgument<>(this.isRequired(), this.getName(), modes, isolationLevel);
|
||||
return new UserArgument<>(this.isRequired(), this.getName(), this.modes, this.isolationLevel);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ public final class UserArgument<C> extends CommandArgument<C, User> {
|
|||
final MessageReceivedEvent event = commandContext.get("MessageReceivedEvent");
|
||||
Exception exception = null;
|
||||
|
||||
if (modes.contains(ParserMode.MENTION)) {
|
||||
if (this.modes.contains(ParserMode.MENTION)) {
|
||||
if (input.startsWith("<@") && input.endsWith(">")) {
|
||||
final String id;
|
||||
if (input.startsWith("<@!")) {
|
||||
|
|
@ -251,7 +251,7 @@ public final class UserArgument<C> extends CommandArgument<C, User> {
|
|||
}
|
||||
}
|
||||
|
||||
if (modes.contains(ParserMode.ID)) {
|
||||
if (this.modes.contains(ParserMode.ID)) {
|
||||
try {
|
||||
final ArgumentParseResult<User> result = this.userFromId(event, input, input);
|
||||
inputQueue.remove();
|
||||
|
|
@ -261,10 +261,10 @@ public final class UserArgument<C> extends CommandArgument<C, User> {
|
|||
}
|
||||
}
|
||||
|
||||
if (modes.contains(ParserMode.NAME)) {
|
||||
if (this.modes.contains(ParserMode.NAME)) {
|
||||
final List<User> users;
|
||||
|
||||
if (isolationLevel == Isolation.GLOBAL) {
|
||||
if (this.isolationLevel == Isolation.GLOBAL) {
|
||||
users = event.getJDA().getUsersByName(input, true);
|
||||
} else if (event.isFromGuild()) {
|
||||
users = event.getGuild().getMembersByEffectiveName(input, true)
|
||||
|
|
@ -302,7 +302,7 @@ public final class UserArgument<C> extends CommandArgument<C, User> {
|
|||
)
|
||||
throws UserNotFoundParseException, NumberFormatException {
|
||||
final User user;
|
||||
if (isolationLevel == Isolation.GLOBAL) {
|
||||
if (this.isolationLevel == Isolation.GLOBAL) {
|
||||
user = event.getJDA().getUserById(id);
|
||||
} else if (event.isFromGuild()) {
|
||||
Member member = event.getGuild().getMemberById(id);
|
||||
|
|
@ -344,7 +344,7 @@ public final class UserArgument<C> extends CommandArgument<C, User> {
|
|||
* @return Users input
|
||||
*/
|
||||
public final @NonNull String getInput() {
|
||||
return input;
|
||||
return this.input;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue