Package me.neznamy.tab.shared
Class DynamicText
java.lang.Object
me.neznamy.tab.shared.DynamicText
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionDynamicText(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. -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeRawValue(String newValue, String newSource) Changes raw value to new provided value and performs all operations related to it.get()getFormat(me.neznamy.tab.api.TabPlayer viewer) Returns source of the raw value or"API"if it comes from an API callvoidsetTemporaryValue(String temporaryValue) booleanupdate()
-
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 valueowner- Player this text belongs torawValue- Raw value using raw placeholder identifierssource- Source of the text used in debug command
-
-
Method Details
-
changeRawValue
Changes raw value to new provided value and performs all operations related to it. Changes source as well.- Parameters:
newValue- new raw value to usenewSource- new source of the text
-
getSource
Returns source of the raw value or"API"if it comes from an API call- Returns:
- source of the value
-
setTemporaryValue
- Specified by:
setTemporaryValuein interfaceme.neznamy.tab.api.Property
-
getCurrentRawValue
- Specified by:
getCurrentRawValuein interfaceme.neznamy.tab.api.Property
-
getTemporaryValue
- Specified by:
getTemporaryValuein interfaceme.neznamy.tab.api.Property
-
getOriginalRawValue
- Specified by:
getOriginalRawValuein interfaceme.neznamy.tab.api.Property
-
updateAndGet
- Specified by:
updateAndGetin interfaceme.neznamy.tab.api.Property
-
update
public boolean update()- Specified by:
updatein interfaceme.neznamy.tab.api.Property
-
get
- Specified by:
getin interfaceme.neznamy.tab.api.Property
-
getFormat
- Specified by:
getFormatin interfaceme.neznamy.tab.api.Property
-