Skip to content

Commit 0886132

Browse files
committed
Spotless
1 parent ce69c27 commit 0886132

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+107
-97
lines changed

application/src/main/java/org/togetherjava/tjbot/Application.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,4 @@ private static void onShutdown() {
105105
logger.info("Bot has been stopped");
106106
}
107107

108-
}
108+
}

application/src/main/java/org/togetherjava/tjbot/commands/BotCommand.java

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
* Represents a Discord command.
1616
* <p>
1717
* All commands have to implement this interface. For convenience, there is a
18-
* {@link BotCommandAdapter} available that implemented most methods already. A new command can
19-
* then be registered by adding it to {@link Features}.
18+
* {@link BotCommandAdapter} available that implemented most methods already. A new command can then
19+
* be registered by adding it to {@link Features}.
2020
* <p>
2121
* <p>
22-
* Commands can either be visible globally in Discord or just to specific guilds. Some configurations can be made via {@link CommandData}, which
23-
* is then to be returned by {@link #getData()} where the system will then pick it up from.
22+
* Commands can either be visible globally in Discord or just to specific guilds. Some
23+
* configurations can be made via {@link CommandData}, which is then to be returned by
24+
* {@link #getData()} where the system will then pick it up from.
2425
* <p>
25-
* After registration, the system will notify a command whenever one of its corresponding
26-
* command method, buttons ({@link #onButtonClick(ButtonInteractionEvent, List)}) or menus
26+
* After registration, the system will notify a command whenever one of its corresponding command
27+
* method, buttons ({@link #onButtonClick(ButtonInteractionEvent, List)}) or menus
2728
* ({@link #onSelectionMenu(SelectMenuInteractionEvent, List)}) have been triggered.
2829
* <p>
2930
* <p>
@@ -49,7 +50,8 @@ public interface BotCommand extends Feature {
4950
*
5051
* @return the type of the command
5152
*/
52-
@NotNull Command.Type getType();
53+
@NotNull
54+
Command.Type getType();
5355

5456

5557
/**
@@ -65,7 +67,8 @@ public interface BotCommand extends Feature {
6567
/**
6668
* Gets the command data belonging to this command.
6769
* <p>
68-
* See {@link net.dv8tion.jda.api.interactions.commands.build.Commands} for details on how to create and configure instances of it.
70+
* See {@link net.dv8tion.jda.api.interactions.commands.build.Commands} for details on how to
71+
* create and configure instances of it.
6972
* <p>
7073
* <p>
7174
* This method may be called multiple times, implementations must not create new data each time
@@ -94,7 +97,8 @@ public interface BotCommand extends Feature {
9497
*
9598
* @param event the event that triggered this
9699
* @param args the arguments transported with the button, see
97-
* {@link #acceptComponentIdGenerator(ComponentIdGenerator)} for details on how these are created
100+
* {@link #acceptComponentIdGenerator(ComponentIdGenerator)} for details on how these are
101+
* created
98102
*/
99103
void onButtonClick(@NotNull ButtonInteractionEvent event, @NotNull List<String> args);
100104

@@ -114,7 +118,8 @@ public interface BotCommand extends Feature {
114118
*
115119
* @param event the event that triggered this
116120
* @param args the arguments transported with the selection menu, see
117-
* {@link #acceptComponentIdGenerator(ComponentIdGenerator)} for details on how these are created
121+
* {@link #acceptComponentIdGenerator(ComponentIdGenerator)} for details on how these are
122+
* created
118123
*/
119124
void onSelectionMenu(@NotNull SelectMenuInteractionEvent event, @NotNull List<String> args);
120125

@@ -129,8 +134,8 @@ public interface BotCommand extends Feature {
129134
* a database entry can be created and a UUID be obtained by using
130135
* {@link ComponentIdGenerator#generate(ComponentId, Lifespan)}, as provided by the instance
131136
* given to this method during system setup. The required {@link ComponentId} instance accepts
132-
* optional extra arguments, which, if provided, can be picked up during the corresponding
133-
* event (see {@link #onButtonClick(ButtonInteractionEvent, List)},
137+
* optional extra arguments, which, if provided, can be picked up during the corresponding event
138+
* (see {@link #onButtonClick(ButtonInteractionEvent, List)},
134139
* {@link #onSelectionMenu(SelectMenuInteractionEvent, List)}).
135140
* <p>
136141
* Alternatively, if {@link BotCommandAdapter} has been extended, it also offers a handy
@@ -143,4 +148,4 @@ public interface BotCommand extends Feature {
143148
* @param generator the provided component id generator
144149
*/
145150
void acceptComponentIdGenerator(@NotNull ComponentIdGenerator generator);
146-
}
151+
}

application/src/main/java/org/togetherjava/tjbot/commands/BotCommandAdapter.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
import java.util.Objects;
1616

1717
/**
18-
* Adapter implementation of a {@link BotCommand}. The minimal setup only requires implementation
19-
* of their respective command method. A new command can then be registered by adding it
20-
* to {@link Features}.
18+
* Adapter implementation of a {@link BotCommand}. The minimal setup only requires implementation of
19+
* their respective command method. A new command can then be registered by adding it to
20+
* {@link Features}.
2121
* <p>
2222
* Further, {@link #onButtonClick(ButtonInteractionEvent, List)} and
23-
* {@link #onSelectionMenu(SelectMenuInteractionEvent, List)} can be overridden if desired. The default
24-
* implementation is empty, the adapter will not react to such events.
23+
* {@link #onSelectionMenu(SelectMenuInteractionEvent, List)} can be overridden if desired. The
24+
* default implementation is empty, the adapter will not react to such events.
2525
* <p>
2626
* <p>
27-
* The adapter manages some getters for you, you've to create the {@link CommandData} yourself.
28-
* See {@link #BotCommandAdapter(CommandData, CommandVisibility)}} for more info on that.
29-
* Minimal modifications can be done on the {@link CommandData} returned by {@link #getData()}
27+
* The adapter manages some getters for you, you've to create the {@link CommandData} yourself. See
28+
* {@link #BotCommandAdapter(CommandData, CommandVisibility)}} for more info on that. Minimal
29+
* modifications can be done on the {@link CommandData} returned by {@link #getData()}
3030
* <p>
3131
* <p>
3232
* If implementations want to add buttons or selection menus, it is highly advised to use component
@@ -81,7 +81,8 @@ public Command.Type getType() {
8181

8282
@Override
8383
public final void acceptComponentIdGenerator(@NotNull ComponentIdGenerator generator) {
84-
componentIdGenerator = Objects.requireNonNull(generator, "The given generator cannot be null");
84+
componentIdGenerator =
85+
Objects.requireNonNull(generator, "The given generator cannot be null");
8586
}
8687

8788
@SuppressWarnings("NoopMethodInAbstractClass")
@@ -92,7 +93,8 @@ public void onButtonClick(@NotNull ButtonInteractionEvent event, @NotNull List<S
9293

9394
@SuppressWarnings("NoopMethodInAbstractClass")
9495
@Override
95-
public void onSelectionMenu(@NotNull SelectMenuInteractionEvent event, @NotNull List<String> args) {
96+
public void onSelectionMenu(@NotNull SelectMenuInteractionEvent event,
97+
@NotNull List<String> args) {
9698
// Adapter does not react by default, subclasses may change this behavior
9799
}
98100

@@ -129,7 +131,8 @@ public void onSelectionMenu(@NotNull SelectMenuInteractionEvent event, @NotNull
129131
*/
130132
@SuppressWarnings({"OverloadedVarargsMethod", "WeakerAccess"})
131133
protected final @NotNull String generateComponentId(@NotNull Lifespan lifespan,
132-
@NotNull String... args) {
133-
return componentIdGenerator.generate(new ComponentId(getName(), Arrays.asList(args)), lifespan);
134+
@NotNull String... args) {
135+
return componentIdGenerator.generate(new ComponentId(getName(), Arrays.asList(args)),
136+
lifespan);
134137
}
135-
}
138+
}

application/src/main/java/org/togetherjava/tjbot/commands/CommandVisibility.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ public enum CommandVisibility {
1212
* The command can be used globally, outside a guild context.
1313
*/
1414
GLOBAL
15-
}
15+
}

application/src/main/java/org/togetherjava/tjbot/commands/ContextCommandAdapter.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
import java.util.List;
1212

1313
/**
14-
* Adapter implementation of a {@link BotCommand}. A new command can be registered by adding it
15-
* to {@link Features}.
14+
* Adapter implementation of a {@link BotCommand}. A new command can be registered by adding it to
15+
* {@link Features}.
1616
* <p>
1717
* Further, {@link #onButtonClick(ButtonInteractionEvent, List)} and
18-
* {@link #onSelectionMenu(SelectMenuInteractionEvent, List)} can be overridden if desired. The default
19-
* implementation is empty, the adapter will not react to such events.
18+
* {@link #onSelectionMenu(SelectMenuInteractionEvent, List)} can be overridden if desired. The
19+
* default implementation is empty, the adapter will not react to such events.
2020
* <p>
2121
* <p>
2222
* The adapter manages all command related data itself, which can be provided during construction
@@ -57,11 +57,13 @@ public abstract class ContextCommandAdapter extends BotCommandAdapter {
5757
* Creates a new adapter with the given data.
5858
*
5959
* @param type the {@link Command.Type type} of the command, can be either
60-
* {@link Command.Type#MESSAGE} or {@link Command.Type#USER}
61-
* @param name the name of the command, see {@link Commands#context(Command.Type, String)} for the requirements
60+
* {@link Command.Type#MESSAGE} or {@link Command.Type#USER}
61+
* @param name the name of the command, see {@link Commands#context(Command.Type, String)} for
62+
* the requirements
6263
* @param visibility the visibility of the command
6364
*/
64-
protected ContextCommandAdapter(@NotNull Command.Type type, @NotNull String name, @NotNull CommandVisibility visibility) {
65+
protected ContextCommandAdapter(@NotNull Command.Type type, @NotNull String name,
66+
@NotNull CommandVisibility visibility) {
6567
super(Commands.context(type, name), visibility);
6668
}
67-
}
69+
}

application/src/main/java/org/togetherjava/tjbot/commands/Features.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ public enum Features {
9191

9292
return features;
9393
}
94-
}
94+
}

application/src/main/java/org/togetherjava/tjbot/commands/MessageContextCommand.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
* then be registered by adding it to {@link Features}.
2121
* <p>
2222
* <p>
23-
* Context commands can either be visible globally in Discord or just to specific guilds.
24-
* Small things can be configured via {@link CommandData}, which is then to be returned by {@link #getData()}
25-
* where the system will then pick it up from.
23+
* Context commands can either be visible globally in Discord or just to specific guilds. Small
24+
* things can be configured via {@link CommandData}, which is then to be returned by
25+
* {@link #getData()} where the system will then pick it up from.
2626
* <p>
2727
* After registration, the system will notify a command whenever one of its corresponding slash
2828
* commands ({@link #onMessageContext(MessageContextInteractionEvent)}), buttons
@@ -36,8 +36,8 @@ public interface MessageContextCommand extends BotCommand {
3636

3737

3838
/**
39-
* Triggered by the core system when a message context-command corresponding to this implementation (based
40-
* on {@link #getData()}) has been triggered.
39+
* Triggered by the core system when a message context-command corresponding to this
40+
* implementation (based on {@link #getData()}) has been triggered.
4141
* <p>
4242
* This method may be called multithreaded. In particular, there are no guarantees that it will
4343
* be executed on the same thread repeatedly or on the same thread that other event methods have
@@ -48,13 +48,13 @@ public interface MessageContextCommand extends BotCommand {
4848
* <p>
4949
* Buttons or menus have to be created with a component ID (see
5050
* {@link ComponentInteraction#getComponentId()},
51-
* {@link net.dv8tion.jda.api.interactions.components.buttons.Button#of(ButtonStyle, String, Emoji)}) in
52-
* a very specific format, otherwise the core system will fail to identify the command that
51+
* {@link net.dv8tion.jda.api.interactions.components.buttons.Button#of(ButtonStyle, String, Emoji)})
52+
* in a very specific format, otherwise the core system will fail to identify the command that
5353
* corresponded to the button or menu click event and is unable to route it back.
5454
* <p>
5555
* See {@link #acceptComponentIdGenerator(ComponentIdGenerator)} for more info
5656
*
5757
* @param event the event that triggered this
5858
*/
5959
void onMessageContext(MessageContextInteractionEvent event);
60-
}
60+
}

application/src/main/java/org/togetherjava/tjbot/commands/MessageReceiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ public interface MessageReceiver extends Feature {
4848
* message that was edited
4949
*/
5050
void onMessageUpdated(@NotNull MessageUpdateEvent event);
51-
}
51+
}

application/src/main/java/org/togetherjava/tjbot/commands/MessageReceiverAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
4444
public void onMessageUpdated(@NotNull MessageUpdateEvent event) {
4545
// Adapter does not react by default, subclasses may change this behavior
4646
}
47-
}
47+
}

application/src/main/java/org/togetherjava/tjbot/commands/SlashCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ public interface SlashCommand extends BotCommand {
9393
void onSlashCommand(@NotNull SlashCommandInteractionEvent event);
9494

9595
/**
96-
* Triggered by the core system when a slash command's autocomplete corresponding to this implementation (based
97-
* on {@link #getData()}) has been triggered.
96+
* Triggered by the core system when a slash command's autocomplete corresponding to this
97+
* implementation (based on {@link #getData()}) has been triggered.
9898
* <p>
9999
* This method may be called multithreaded. In particular, there are no guarantees that it will
100100
* be executed on the same thread repeatedly or on the same thread that other event methods have
@@ -108,4 +108,4 @@ public interface SlashCommand extends BotCommand {
108108
* @param event the event that triggered this
109109
*/
110110
void onAutoComplete(@NotNull CommandAutoCompleteInteractionEvent event);
111-
}
111+
}

0 commit comments

Comments
 (0)