Class VariableBundle

java.lang.Object
me.hsgamer.hscore.variable.VariableBundle

public class VariableBundle extends Object
A bundle of variables that is useful for grouping variables
  • Constructor Details

    • VariableBundle

      public VariableBundle(VariableManager variableManager)
      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

      public boolean register(String prefix, StringReplacer variable, boolean isWhole)
      Register new variable
      Parameters:
      prefix - the prefix
      variable - the replacer
      isWhole - 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

      public boolean register(String prefix, StringReplacer variable)
      Register new variable
      Parameters:
      prefix - the prefix
      variable - the Variable object
      Returns:
      true if the registration is successful or false if the prefix already exists
    • unregister

      public boolean unregister(String prefix)
      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