Class EntitySelectMenu.Builder
java.lang.Object
net.dv8tion.jda.api.components.selections.SelectMenu.Builder<EntitySelectMenu, EntitySelectMenu.Builder>
net.dv8tion.jda.api.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.setDefaultValues(Collection<? extends EntitySelectMenu.DefaultValue> values) Thedefault valuesthat will be shown to the user.setDefaultValues(EntitySelectMenu.DefaultValue... values) Thedefault valuesthat will be shown to the user.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 SelectMenu.Builder
getCustomId, getMaxValues, getMinValues, getPlaceholder, getUniqueId, isDisabled, isRequired, setCustomId, setDisabled, setMaxValues, setMinValues, setPlaceholder, setRequired, setRequiredRange, setUniqueId
-
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
-
setDefaultValues
@Nonnull public EntitySelectMenu.Builder setDefaultValues(@Nonnull EntitySelectMenu.DefaultValue... values) Thedefault valuesthat 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 valuesthat 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 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()
-