Class VariableRegistry

java.lang.Object
io.lumine.mythic.core.skills.variables.VariableRegistry
All Implemented Interfaces:
Cloneable

public class VariableRegistry extends Object implements Cloneable
  • Constructor Details

    • VariableRegistry

      public VariableRegistry()
      Create a new instance.
    • VariableRegistry

      public VariableRegistry(Map<String,Variable> value)
      Create a new instance and use the given map (which will be modified).
      Parameters:
      value - the value
  • Method Details

    • put

      public void put(String key, Variable value)
      Put the given key and variable into the registry.
      Parameters:
      key - they key
      value - the value
    • putAll

      public void putAll(Map<String,? extends Variable> value)
      Put all the entries from the given map into the registry
      Parameters:
      value - the map of variables
    • remove

      public void remove(String key)
      Remove the given entry from the registry, if it exists
      Parameters:
      key -
    • has

      public boolean has(String key)
    • get

      public Variable get(String key)
    • getOrDefault

      public Variable getOrDefault(String key, Variable def)
    • putInt

      public void putInt(String key, int value)
      Put the given key and value into the registry as a IntVariable.
      Parameters:
      key - they key
      value - the value
    • getInt

      public int getInt(String key)
      Get the variable with the given key as an integer, if possible
      Parameters:
      key -
      Returns:
    • putString

      public void putString(String key, String value)
      Put the given key and value into the registry as a StringVariable.
      Parameters:
      key - they key
      value - the value
    • getString

      public String getString(String key)
    • putFloat

      public void putFloat(String key, float value)
      Put the given key and value into the registry as a FloatVariable.
      Parameters:
      key - they key
      value - the value
    • getFloat

      public float getFloat(String key)
      Get the variable with the given key as an integer, if possible
      Parameters:
      key -
      Returns:
    • putLocation

      public void putLocation(String key, AbstractLocation value)
      Put the given key and value into the registry as a LocationVariable.
      Parameters:
      key - they key
      value - the value
    • putVector

      public void putVector(String key, AbstractVector value)
      Put the given key and value into the registry as a VectorVariable.
      Parameters:
      key - they key
      value - the value
    • putObject

      public void putObject(String key, Object value)
      Put the given key and value into the registry as an object. Cannot be saved.
      Parameters:
      key - they key
      value - the value
    • asMap

      public com.google.common.collect.ImmutableMap<String,Variable> asMap()
      Get the registry as an immutable map
      Returns:
    • clean

      public void clean()
    • unload

      public void unload()
    • clone

      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException