Package me.hsgamer.hscore.variable
Class VariableManager
java.lang.Object
me.hsgamer.hscore.variable.VariableManager
- All Implemented Interfaces:
StringReplacer
The variable manager for the instance
-
Field Summary
Fields inherited from interface me.hsgamer.hscore.common.StringReplacer
DUMMY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet all variable entriesGet all variablesvoidregister(String prefix, StringReplacer variable) Register new variablevoidregister(String prefix, StringReplacer variable, boolean isWhole) Register new variable@Nullable StringReplace a string@Nullable StringReplace a string based on the unique idvoidunregister(String prefix) Unregister a variableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.hsgamer.hscore.common.StringReplacer
replaceOrDefault, replaceOrOriginal, tryReplace
-
Constructor Details
-
VariableManager
public VariableManager()
-
-
Method Details
-
register
Register new variable- Parameters:
prefix- the prefixvariable- the replacerisWhole- whether the manager should check the whole string matches the prefix, set it to false if you want to check if the prefix is at the beginning of the string
-
register
Register new variable- Parameters:
prefix- the prefixvariable- the Variable object
-
unregister
Unregister a variable- Parameters:
prefix- the prefix
-
getVariables
Get all variables- Returns:
- the variables
-
getVariableEntries
Get all variable entries- Returns:
- the variable entries
-
replace
Description copied from interface:StringReplacerReplace a string- Specified by:
replacein interfaceStringReplacer- Parameters:
original- the original string- Returns:
- the replaced string
-
replace
@Nullable public @Nullable String replace(@NotNull @NotNull String original, @NotNull @NotNull UUID uuid) Description copied from interface:StringReplacerReplace a string based on the unique id- Specified by:
replacein interfaceStringReplacer- Parameters:
original- the original stringuuid- the unique id- Returns:
- the replaced string
-