Class Condition
java.lang.Object
me.neznamy.tab.shared.placeholders.conditions.Condition
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 Summary
FieldsModifier and TypeFieldDescriptionprotected SimpleCondition[]All defined sub-conditions inside this conditions -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClears registered condition map on plugin reloadstatic ConditiongetCondition(String string) Returns condition from given string.static Map<String,Function<String, SimpleCondition>> Returns map of all registered condition typesgetName()Returns name of this conditionintReturns refresh interval of placeholder made from this conditiongetText(me.neznamy.tab.api.TabPlayer p) Returns text for player based on if condition is met or notbooleanisMet(me.neznamy.tab.api.TabPlayer p) Returnstrueif condition is met for player,falseif not
-
Field Details
-
subConditions
All defined sub-conditions inside this conditions
-
-
Constructor Details
-
Condition
Constructs new instance with given parameters and registers this condition to list as well as the placeholder.- Parameters:
name- name of conditionconditions- list of condition linesyes- value to return if condition is metno- 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
Returns name of this condition- Returns:
- name of this condition
-
getText
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) Returnstrueif condition is met for player,falseif not- Parameters:
p- player to check conditions for- Returns:
trueif met,falseif not
-
getCondition
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
Returns map of all registered condition types- Returns:
- all registered condition types
-