Class VariableManager

java.lang.Object
me.hsgamer.hscore.variable.VariableManager
All Implemented Interfaces:
StringReplacer

public class VariableManager extends Object implements StringReplacer
The variable manager for the instance
  • Constructor Details

    • VariableManager

      public VariableManager()
  • Method Details

    • register

      public void 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
    • register

      public void register(String prefix, StringReplacer variable)
      Register new variable
      Parameters:
      prefix - the prefix
      variable - the Variable object
    • unregister

      public void unregister(String prefix)
      Unregister a variable
      Parameters:
      prefix - the prefix
    • getVariables

      public Map<String,StringReplacer> getVariables()
      Get all variables
      Returns:
      the variables
    • getVariableEntries

      public List<Variable> getVariableEntries()
      Get all variable entries
      Returns:
      the variable entries
    • replace

      @Nullable public @Nullable String replace(@NotNull @NotNull String original)
      Description copied from interface: StringReplacer
      Replace a string
      Specified by:
      replace in interface StringReplacer
      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: StringReplacer
      Replace a string based on the unique id
      Specified by:
      replace in interface StringReplacer
      Parameters:
      original - the original string
      uuid - the unique id
      Returns:
      the replaced string