Package me.hsgamer.hscore.variable
Class VariableBundle
java.lang.Object
me.hsgamer.hscore.variable.VariableBundle
A bundle of variables that is useful for grouping variables
-
Constructor Summary
ConstructorDescriptionCreate a new bundle for the global variable managerVariableBundle
(VariableManager variableManager) Create a new bundle for the variable manager -
Method Summary
Modifier and TypeMethodDescriptionboolean
register
(String prefix, StringReplacer variable) Register new variableboolean
register
(String prefix, StringReplacer variable, boolean isWhole) Register new variableboolean
unregister
(String prefix) Unregister a variablevoid
Unregister all variables
-
Constructor Details
-
VariableBundle
Create a new bundle for the variable manager- Parameters:
variableManager
- the variable manager
-
VariableBundle
public VariableBundle()Create a new bundle for the global variable manager
-
-
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- Returns:
- true if the registration is successful or false if the prefix already exists
-
register
Register new variable- Parameters:
prefix
- the prefixvariable
- the Variable object- Returns:
- true if the registration is successful or false if the prefix already exists
-
unregister
Unregister a variable- Parameters:
prefix
- the prefix- Returns:
- true if the un-registration is successful or false if the prefix doesn't exist
-
unregisterAll
public void unregisterAll()Unregister all variables
-