Interface InputElement

All Superinterfaces:
DomQueryable, Element, EventTarget, Node

public interface InputElement extends Element
An element that can take in a player's input
  • Field Details

  • Method Details

    • canHaveChildren

      @Contract("-> false") boolean canHaveChildren()
      Input elements cannot have child nodes.
      Specified by:
      canHaveChildren in interface Element
      Returns:
      false
    • isDisabled

      boolean isDisabled()
      Test if the element is disabled.

      This element can be disabled by setting the Attributes.ENABLED attribute to false.

      Returns:
      true, if the element is disabled, false otherwise
    • setDisabled

      void setDisabled(boolean disabled)
      Set the Attributes.ENABLED attribute
      Parameters:
      disabled - true to disable the element, false otherwise.
    • getPrompt

      String getPrompt()
      Get the Attributes.PROMPT attribute value.

      The prompt is displayed to players when asking for input

      Returns:
      Prompt
    • setPrompt

      void setPrompt(@Nullable @Nullable String prompt)
      Set the Attributes.PROMPT attribute value.

      The prompt is displayed to players when asking for input

      Parameters:
      prompt - Prompt
    • getType

      @NotNull @NotNull InputElement.InputType getType()
      Get the input type from the Attributes.TYPE attribute.

      If the attribute isn't set or its value does not map to an enum value, then InputElement.InputType.TEXT is returned.

      Returns:
      Input type
    • setType

      void setType(@Nullable @Nullable InputElement.InputType type)
      Set the input type
      Parameters:
      type - Input type, or null.
    • getValue

      @Nullable @Nullable String getValue()
      Get the inputted value
      Returns:
      Inputted value, may be an empty string or null
    • setValue

      void setValue(@Nullable @Nullable String value)
      Set the inputted value.

      Triggers a EventTypes.INPUT event.

      Parameters:
      value - New element value
    • setValue

      void setValue(@Nullable @Nullable String value, @NotNull @NotNull org.bukkit.entity.Player player)
      Set the inputted value.

      Triggers a EventTypes.INPUT event.

      Parameters:
      value - New element value
      player - Player that changed the element
    • getPlaceholder

      @NotNull @NotNull String getPlaceholder()
      Get the element's placeholder, or a fallback value, if not set.

      Placeholders are set with the Attributes.PLACEHOLDER attribute. If the attribute is not explicitly set, then this method returns DEFAULT_PLACEHOLDER.

      Returns:
      Placeholder
    • setPlaceholder

      void setPlaceholder(@Nullable @Nullable String placeholder)
      Set the value of the Attributes.PLACEHOLDER attribute.
      Parameters:
      placeholder - New placeholder