java.lang.Object
me.neznamy.tab.shared.placeholders.conditions.Condition

public class Condition extends Object
The main condition class. It allows users to configure different condition types that must be met in order to display specified text or make a condition requirement for a visual to be displayed.
  • Field Details

    • subConditions

      protected SimpleCondition[] subConditions
      All defined sub-conditions inside this conditions
  • Constructor Details

    • Condition

      public Condition(boolean type, String name, List<String> conditions, String yes, String no)
      Constructs new instance with given parameters and registers this condition to list as well as the placeholder.
      Parameters:
      name - name of condition
      conditions - list of condition lines
      yes - value to return if condition is met
      no - value to return if condition is not met
  • Method Details

    • getRefresh

      public int getRefresh()
      Returns refresh interval of placeholder made from this condition
      Returns:
      refresh interval of placeholder made from this condition
    • getName

      public String getName()
      Returns name of this condition
      Returns:
      name of this condition
    • getText

      public String getText(me.neznamy.tab.api.TabPlayer p)
      Returns text for player based on if condition is met or not
      Parameters:
      p - player to check condition for
      Returns:
      yes or no value depending on if condition passed or not
    • isMet

      public boolean isMet(me.neznamy.tab.api.TabPlayer p)
      Returns true if condition is met for player, false if not
      Parameters:
      p - player to check conditions for
      Returns:
      true if met, false if not
    • getCondition

      public static Condition getCondition(String string)
      Returns condition from given string. If the string is name of a condition, that condition is returned. If it's a condition pattern, it is compiled and returned. If the string is null, null is returned.
      Parameters:
      string - condition name or pattern
      Returns:
      condition from string
    • clearConditions

      public static void clearConditions()
      Clears registered condition map on plugin reload
    • getConditionTypes

      public static Map<String,Function<String,SimpleCondition>> getConditionTypes()
      Returns map of all registered condition types
      Returns:
      all registered condition types