Interface IDisableable
- All Superinterfaces:
Component
- All Known Subinterfaces:
ActionComponent
,ActionRow
,Button
,Container
,EntitySelectMenu
,Section
,SelectMenu
,StringSelectMenu
,TextInput
- All Known Implementing Classes:
ActionRowImpl
,ButtonImpl
,ContainerImpl
,EntitySelectMenuImpl
,SectionImpl
,SelectMenuImpl
,StringSelectMenuImpl
,TextInputImpl
Component which supports being disabled or having its children be disabled.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.components.Component
Component.Type
-
Method Summary
Modifier and TypeMethodDescriptiondefault IDisableable
Returns a new instance of this component in a disabled state.default IDisableable
Returns a new instance of this component in an enabled state.boolean
Whether this component is disabled.default boolean
Whether this component is enabled.withDisabled
(boolean disabled) Returns a new instance of this component in an enabled/disabled state.withUniqueId
(int uniqueId) Creates a new component with the provided numeric ID.Methods inherited from interface net.dv8tion.jda.api.components.Component
getType, getUniqueId, isMessageCompatible, isModalCompatible
-
Method Details
-
isDisabled
boolean isDisabled()Whether this component is disabled.For layout components, this means all children are enabled.
When this returnsfalse
, this does not meanisEnabled()
istrue
! (for example, when one component is enabled and the other is disabled)You can use
asDisabled()
orasEnabled()
to create enabled/disabled instances.- Returns:
true
, if this component is disabled
-
isEnabled
default boolean isEnabled()Whether this component is enabled.For layout components, this means all children are enabled.
When this returnsfalse
, this does not meanisDisabled()
istrue
! (for example, when one component is enabled and the other is disabled)You can use
asDisabled()
orasEnabled()
to create enabled/disabled instances.- Returns:
true
if this component is enabled
-
withUniqueId
Description copied from interface:Component
Creates a new component with the provided numeric ID.
If no ID is set, Discord will generate IDs incrementally starting from 1 and will not use existing IDs from the same message/modal.- Specified by:
withUniqueId
in interfaceComponent
- Parameters:
uniqueId
- The new ID; must be higher or equal to 1- Returns:
- The new component
-
withDisabled
Returns a new instance of this component in an enabled/disabled state.
For layout components, this enables/disables all the components it contains.- Returns:
- The new component in an enabled/disabled state
- See Also:
-
asDisabled
Returns a new instance of this component in a disabled state.
For layout components, this disables all the components it contains.- Returns:
- The new component in a disabled state
- See Also:
-
asEnabled
Returns a new instance of this component in an enabled state.
For layout components, this enables all the components it contains.- Returns:
- The new component in an enabled state
- See Also:
-