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

public interface IDisableable extends Component
Component which supports being disabled or having its children be disabled.
  • Method Details

    • isDisabled

      boolean isDisabled()
      Whether this component is disabled.

      For layout components, this means all children are enabled.
      When this returns false, this does not mean isEnabled() is true! (for example, when one component is enabled and the other is disabled)

      You can use asDisabled() or asEnabled() 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 returns false, this does not mean isDisabled() is true! (for example, when one component is enabled and the other is disabled)

      You can use asDisabled() or asEnabled() to create enabled/disabled instances.

      Returns:
      true if this component is enabled
    • withUniqueId

      @Nonnull IDisableable withUniqueId(int uniqueId)
      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 interface Component
      Parameters:
      uniqueId - The new ID; must be higher or equal to 1
      Returns:
      The new component
    • withDisabled

      @Nonnull @CheckReturnValue IDisableable withDisabled(boolean disabled)
      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

      @Nonnull @CheckReturnValue default IDisableable 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: