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 newEntitySelectMenuinstance if all requirements are satisfied.setChannelTypes(Collection<ChannelType> types) TheChannelTypesthat should be supported by this menu.setChannelTypes(ChannelType... types) TheChannelTypesthat should be supported by this menu.TheSelectTargetsthat should be supported by this menu.setEntityTypes(EntitySelectMenu.SelectTarget type, EntitySelectMenu.SelectTarget... types) TheSelectTargetsthat 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) TheSelectTargetsthat 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) TheSelectTargetsthat should be supported by this menu.- Parameters:
type- The first supportedEntitySelectMenu.SelectTargettypes- Additional supportedSelectTargets- Returns:
- The current Builder instance
- Throws:
IllegalArgumentException- If the provided targets are null or invalid.
-
setChannelTypes
TheChannelTypesthat should be supported by this menu.
This is only relevant for menus that allowCHANNELtargets.- 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
TheChannelTypesthat should be supported by this menu.
This is only relevant for menus that allowCHANNELtargets.- 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 newEntitySelectMenuinstance if all requirements are satisfied.- Specified by:
buildin classSelectMenu.Builder<EntitySelectMenu,EntitySelectMenu.Builder> - Returns:
- The new
EntitySelectMenuinstance - Throws:
IllegalArgumentException- Throws ifSelectMenu.Builder.getMinValues()is greater thanSelectMenu.Builder.getMaxValues()
-