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.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
-
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()
-