Class EntitySelectMenu.Builder
java.lang.Object
net.dv8tion.jda.api.interactions.components.selections.SelectMenu.Builder<EntitySelectMenu,EntitySelectMenu.Builder>
net.dv8tion.jda.api.interactions.components.selections.EntitySelectMenu.Builder
- Enclosing interface:
EntitySelectMenu
public static class EntitySelectMenu.Builder
extends SelectMenu.Builder<EntitySelectMenu,EntitySelectMenu.Builder>
A preconfigured builder for the creation of entity select menus.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates a newEntitySelectMenu
instance if all requirements are satisfied.setChannelTypes
(Collection<ChannelType> types) TheChannelTypes
that should be supported by this menu.setChannelTypes
(ChannelType... types) TheChannelTypes
that should be supported by this menu.setDefaultValues
(Collection<? extends EntitySelectMenu.DefaultValue> values) Thedefault values
that will be shown to the user.setDefaultValues
(EntitySelectMenu.DefaultValue... values) Thedefault values
that will be shown to the user.TheSelectTargets
that should be supported by this menu.setEntityTypes
(EntitySelectMenu.SelectTarget type, EntitySelectMenu.SelectTarget... types) TheSelectTargets
that should be supported by this menu.Methods inherited from class net.dv8tion.jda.api.interactions.components.selections.SelectMenu.Builder
getId, getMaxValues, getMinValues, getPlaceholder, isDisabled, setDisabled, setId, setMaxValues, setMinValues, setPlaceholder, setRequiredRange
-
Method Details
-
setEntityTypes
@Nonnull public EntitySelectMenu.Builder setEntityTypes(@Nonnull Collection<EntitySelectMenu.SelectTarget> types) TheSelectTargets
that should be supported by this menu.- Parameters:
types
- The supportedSelectTargets
(1-2)- Returns:
- The current Builder instance
- Throws:
IllegalArgumentException
- If the provided targets are null, empty, or invalid.
-
setEntityTypes
@Nonnull public EntitySelectMenu.Builder setEntityTypes(@Nonnull EntitySelectMenu.SelectTarget type, @Nonnull EntitySelectMenu.SelectTarget... types) TheSelectTargets
that should be supported by this menu.- Parameters:
type
- The first supportedEntitySelectMenu.SelectTarget
types
- Additional supportedSelectTargets
- Returns:
- The current Builder instance
- Throws:
IllegalArgumentException
- If the provided targets are null or invalid.
-
setChannelTypes
TheChannelTypes
that should be supported by this menu.
This is only relevant for menus that allowCHANNEL
targets.- Parameters:
types
- The supportedChannelTypes
(empty to allow all types)- Returns:
- The current Builder instance
- Throws:
IllegalArgumentException
- If the provided types are null or not guild types
-
setChannelTypes
TheChannelTypes
that should be supported by this menu.
This is only relevant for menus that allowCHANNEL
targets.- Parameters:
types
- The supportedChannelTypes
(empty to allow all types)- Returns:
- The current Builder instance
- Throws:
IllegalArgumentException
- If the provided types are null or not guild types
-
setDefaultValues
@Nonnull public EntitySelectMenu.Builder setDefaultValues(@Nonnull EntitySelectMenu.DefaultValue... values) Thedefault values
that will be shown to the user.- Parameters:
values
- The default values (up to 25)- Returns:
- The current Builder instance
- Throws:
IllegalArgumentException
- If null is provided, more than 25 values are provided, or any of the value types is incompatible with the configuredentity types
.
-
setDefaultValues
@Nonnull public EntitySelectMenu.Builder setDefaultValues(@Nonnull Collection<? extends EntitySelectMenu.DefaultValue> values) Thedefault values
that will be shown to the user.- Parameters:
values
- The default values (up to 25)- Returns:
- The current Builder instance
- Throws:
IllegalArgumentException
- If null is provided, more than 25 values are provided, or any of the value types is incompatible with the configuredentity types
.
-
build
Creates a newEntitySelectMenu
instance if all requirements are satisfied.- Specified by:
build
in classSelectMenu.Builder<EntitySelectMenu,
EntitySelectMenu.Builder> - Returns:
- The new
EntitySelectMenu
instance - Throws:
IllegalArgumentException
- Throws ifSelectMenu.Builder.getMinValues()
is greater thanSelectMenu.Builder.getMaxValues()
-