Class KeyPlaceholder
java.lang.Object
ua.mcchickenstudio.opencreative.coding.placeholders.Placeholder
ua.mcchickenstudio.opencreative.coding.placeholders.KeyPlaceholder
- All Implemented Interfaces:
ExtensionContent
- Direct Known Subclasses:
EntityPlaceholder, EventPlaceholder, PlanetPlaceholder, PlayerPlaceholder, RandomPlaceholder, SymbolPlaceholder, TargetPlaceholder
KeyPlaceholder
This class represents a key placeholder, that has keys that will be replaced, if text will contain them in "percents format":%example%
Should be used for creation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionString[]getKeys()Returns array of keys that can be replaced, without %.static PatternbooleanReturnstrueif specified text contains placeholders that can be parsed with this class.@NotNull Stringparse(String text, ActionsHandler handler, Action action) Returns text with parsed placeholders from this class.abstract @Nullable StringparseKey(String key, ActionsHandler handler, Action action) Parses placeholder key, without %.Methods inherited from class Placeholder
toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ExtensionContent
getDescription, getExtensionId, getName
-
Constructor Details
-
KeyPlaceholder
-
-
Method Details
-
getPatternPlaceholder
-
matches
Description copied from class:PlaceholderReturnstrueif specified text contains placeholders that can be parsed with this class.- Specified by:
matchesin classPlaceholder- Parameters:
text- text to check.- Returns:
- true - placeholders detected, false - not detected.
-
getKeys
Returns array of keys that can be replaced, without %.- Returns:
- array of keys.
-
parseKey
@Nullable public abstract @Nullable String parseKey(String key, ActionsHandler handler, Action action) Parses placeholder key, without %.- Parameters:
key- key to replace.handler- action handler.action- action- Returns:
- string - if parsed, or null - nothing parsed.
-
parse
Description copied from class:PlaceholderReturns text with parsed placeholders from this class.- Specified by:
parsein classPlaceholder- Parameters:
text- text to parse.handler- action handler.action- action.- Returns:
- parsed text
-