33import net .dv8tion .jda .api .events .interaction .ModalInteractionEvent ;
44import net .dv8tion .jda .api .events .interaction .command .SlashCommandInteractionEvent ;
55import net .dv8tion .jda .api .events .interaction .component .ButtonInteractionEvent ;
6- import net .dv8tion .jda .api .events .interaction .component .SelectMenuInteractionEvent ;
6+ import net .dv8tion .jda .api .events .interaction .component .EntitySelectInteractionEvent ;
7+ import net .dv8tion .jda .api .events .interaction .component .StringSelectInteractionEvent ;
78
89import org .togetherjava .tjbot .features .componentids .ComponentId ;
910import org .togetherjava .tjbot .features .componentids .ComponentIdGenerator ;
2021 * if their type is different, all the types can be seen in {@link UserInteractionType}
2122 */
2223public interface UserInteractor extends Feature {
23-
2424 /**
2525 * Gets the name of the interactor.
2626 * <p>
@@ -58,11 +58,14 @@ public interface UserInteractor extends Feature {
5858 * {@link SlashCommand#onSlashCommand(SlashCommandInteractionEvent)} for details on how
5959 * these are created
6060 */
61- void onButtonClick (ButtonInteractionEvent event , List <String > args );
61+ @ SuppressWarnings ("NoopMethodInInterface" )
62+ default void onButtonClick (ButtonInteractionEvent event , List <String > args ) {
63+ // Interface does not react by default, implementations may change this behaviour
64+ }
6265
6366 /**
64- * Triggered by the core system when a selection menu corresponding to this implementation
65- * (based on {@link #getName()}) has been clicked.
67+ * Triggered by the core system when an entity selection menu corresponding to this
68+ * implementation (based on {@link #getName()}) has been clicked.
6669 * <p>
6770 * This method may be called multithreaded. In particular, there are no guarantees that it will
6871 * be executed on the same thread repeatedly or on the same thread that other event methods have
@@ -76,8 +79,31 @@ public interface UserInteractor extends Feature {
7679 * {@link SlashCommand#onSlashCommand(SlashCommandInteractionEvent)} for details on how
7780 * these are created
7881 */
79- void onSelectMenuSelection (SelectMenuInteractionEvent event , List <String > args );
82+ @ SuppressWarnings ("NoopMethodInInterface" )
83+ default void onEntitySelectSelection (EntitySelectInteractionEvent event , List <String > args ) {
84+ // Interface does not react by default, implementations may change this behaviour
85+ }
8086
87+ /**
88+ * Triggered by the core system when a string selection menu corresponding to this
89+ * implementation (based on {@link #getName()}) has been clicked.
90+ * <p>
91+ * This method may be called multithreaded. In particular, there are no guarantees that it will
92+ * be executed on the same thread repeatedly or on the same thread that other event methods have
93+ * been called on.
94+ * <p>
95+ * Details are available in the given event and the event also enables implementations to
96+ * respond to it.
97+ *
98+ * @param event the event that triggered this
99+ * @param args the arguments transported with the selection menu, see
100+ * {@link SlashCommand#onSlashCommand(SlashCommandInteractionEvent)} for details on how
101+ * these are created
102+ */
103+ @ SuppressWarnings ("NoopMethodInInterface" )
104+ default void onStringSelectSelection (StringSelectInteractionEvent event , List <String > args ) {
105+ // Interface does not react by default, implementations may change this behaviour
106+ }
81107
82108 /**
83109 * Triggered by the core system when a modal corresponding to this implementation (based on
@@ -95,7 +121,10 @@ public interface UserInteractor extends Feature {
95121 * {@link SlashCommand#onSlashCommand(SlashCommandInteractionEvent)} for details on how
96122 * these are created
97123 */
98- void onModalSubmitted (ModalInteractionEvent event , List <String > args );
124+ @ SuppressWarnings ("NoopMethodInInterface" )
125+ default void onModalSubmitted (ModalInteractionEvent event , List <String > args ) {
126+ // Interface does not react by default, implementations may change this behaviour
127+ }
99128
100129 /**
101130 * Triggered by the core system during its setup phase. It will provide the command a component
@@ -110,7 +139,8 @@ public interface UserInteractor extends Feature {
110139 * given to this method during system setup. The required {@link ComponentId} instance accepts
111140 * optional extra arguments, which, if provided, can be picked up during the corresponding event
112141 * (see {@link #onButtonClick(ButtonInteractionEvent, List)},
113- * {@link #onSelectMenuSelection(SelectMenuInteractionEvent, List)}).
142+ * {@link #onEntitySelectSelection(EntitySelectInteractionEvent, List)},
143+ * {@link #onStringSelectSelection(StringSelectInteractionEvent, List)}).
114144 * <p>
115145 * Alternatively, if {@link BotCommandAdapter} has been extended, it also offers a handy
116146 * {@link BotCommandAdapter#generateComponentId(String...)} method to ease the flow.
0 commit comments