Class Component

java.lang.Object
net.botwithus.rs3.game.hud.interfaces.Component
All Implemented Interfaces:
Interactable<Integer>

public final class Component extends Object implements Interactable<Integer>
  • Constructor Details

    • Component

      public Component(int type, int spriteId, int interfaceIndex, int componentIndex, int subComponentIndex, int properties, String text, int fontId, int textColor, int textAlpha, int itemId, int itemAmount, @NotNull @NotNull String[] options, @NotNull @NotNull ComponentParam[] params)
  • Method Details

    • setOptionMapper

      public void setOptionMapper(Function<Integer,Integer> mapper)
    • getType

      @Nullable public Component.Type getType()
    • getInterfaceIndex

      public int getInterfaceIndex()
    • getComponentIndex

      public int getComponentIndex()
    • getSubComponentIndex

      public int getSubComponentIndex()
    • getText

      public String getText()
    • getTextFontId

      public int getTextFontId()
    • getTextColor

      public Color getTextColor()
    • getTextAlpha

      public int getTextAlpha()
    • getItemId

      public int getItemId()
    • getItemAmount

      public int getItemAmount()
    • getSpriteId

      public int getSpriteId()
    • interact

      public boolean interact()
      Executes the action in index 0.
      Returns:
      true if the action was successful, false otherwise
    • interact

      public boolean interact(@NotNull @NotNull Integer option)
      Executes the action associated with the given option.
      Specified by:
      interact in interface Interactable<Integer>
      Parameters:
      option - the option to execute
      Returns:
      true if the action was executed successfully, false otherwise
    • getOptions

      @NotNull public @NotNull List<String> getOptions()
      Description copied from interface: Interactable
      Gets the options available for this Interactable
      Specified by:
      getOptions in interface Interactable<Integer>
      Returns:
      a list of strings containing the options
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getParams

      public List<ComponentParam> getParams()
      Gets params related to this component
      Returns:
      the params list
    • getParam

      public Optional<Object> getParam(int id)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getDefaultMapper

      public Function<Integer,Integer> getDefaultMapper()
      Description copied from interface: Interactable
      Returns a default Function that throws an UnsupportedOperationException when called.
      Specified by:
      getDefaultMapper in interface Interactable<Integer>
      Returns:
      a default Function
    • getProperties

      public ComponentProperties getProperties()
      Component properties that tells you if the component is draggable or a dialogue.
      Returns:
      the properties of this component