Class DynamicText

java.lang.Object
me.neznamy.tab.shared.DynamicText
All Implemented Interfaces:
me.neznamy.tab.api.Property

public class DynamicText extends Object implements me.neznamy.tab.api.Property
A dynamic text with placeholder support. If any placeholder used in this text changes value, feature defining this text will receive refresh call letting it know and allowing to get new value.
  • Constructor Details

    • DynamicText

      public DynamicText(String name, me.neznamy.tab.api.TabFeature listener, me.neznamy.tab.api.TabPlayer owner, String rawValue, String source)
      Constructs new instance with given parameters and prepares the formatter for use by detecting placeholders and reformatting the text.
      Parameters:
      listener - Feature which should receive refresh method if placeholder changes value
      owner - Player this text belongs to
      rawValue - Raw value using raw placeholder identifiers
      source - Source of the text used in debug command
  • Method Details

    • changeRawValue

      public void changeRawValue(String newValue, String newSource)
      Changes raw value to new provided value and performs all operations related to it. Changes source as well.
      Parameters:
      newValue - new raw value to use
      newSource - new source of the text
    • getSource

      public String getSource()
      Returns source of the raw value or "API" if it comes from an API call
      Returns:
      source of the value
    • setTemporaryValue

      public void setTemporaryValue(String temporaryValue)
      Specified by:
      setTemporaryValue in interface me.neznamy.tab.api.Property
    • getCurrentRawValue

      public String getCurrentRawValue()
      Specified by:
      getCurrentRawValue in interface me.neznamy.tab.api.Property
    • getTemporaryValue

      public String getTemporaryValue()
      Specified by:
      getTemporaryValue in interface me.neznamy.tab.api.Property
    • getOriginalRawValue

      public String getOriginalRawValue()
      Specified by:
      getOriginalRawValue in interface me.neznamy.tab.api.Property
    • updateAndGet

      public String updateAndGet()
      Specified by:
      updateAndGet in interface me.neznamy.tab.api.Property
    • update

      public boolean update()
      Specified by:
      update in interface me.neznamy.tab.api.Property
    • get

      public String get()
      Specified by:
      get in interface me.neznamy.tab.api.Property
    • getFormat

      public String getFormat(me.neznamy.tab.api.TabPlayer viewer)
      Specified by:
      getFormat in interface me.neznamy.tab.api.Property