Skip to content

Commit

Permalink
Add abstract createCopy method in SelectMenu (#2684)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaktushose authored Jul 21, 2024
1 parent fa57bc2 commit 9ae7e5c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ default EntitySelectMenu withDisabled(boolean disabled)
*/
@Nonnull
@CheckReturnValue
@Override
default Builder createCopy()
{
//noinspection ConstantConditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.dv8tion.jda.api.interactions.components.ActionComponent;
import net.dv8tion.jda.internal.utils.Checks;

import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
Expand Down Expand Up @@ -78,6 +79,16 @@ public interface SelectMenu extends ActionComponent
*/
int getMaxValues();

/**
* Creates a new preconfigured {@link SelectMenu.Builder} with the same settings used for this select menu.
* <br>This can be useful to create an updated version of this menu without needing to rebuild it from scratch.
*
* @return The {@link SelectMenu.Builder} used to create the select menu
*/
@Nonnull
@CheckReturnValue
Builder<? extends SelectMenu, ? extends Builder<?, ?>> createCopy();

/**
* A preconfigured builder for the creation of select menus.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ default StringSelectMenu withDisabled(boolean disabled)
*/
@Nonnull
@CheckReturnValue
@Override
default Builder createCopy()
{
//noinspection ConstantConditions
Expand Down

0 comments on commit 9ae7e5c

Please sign in to comment.