Class VectorGenerator

java.lang.Object
wbs.utils.util.providers.generator.vector.VectorGenerator
All Implemented Interfaces:
Provider, Refreshable
Direct Known Subclasses:
VectorBinaryFunctionalGenerator, VectorFunctionalGenerator, VectorGeneratorNormalise, VectorGeneratorRotate

public abstract class VectorGenerator extends Object implements Provider
A generator that returns a single Vector until refresh() is called, at which point it calculates a new value.
  • Constructor Details

    • VectorGenerator

      protected VectorGenerator()
    • VectorGenerator

      public VectorGenerator(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory)
      Create this generator from a ConfigurationSection, logging errors in the given settings
      Parameters:
      section - The section where this generator is defined
      settings - The settings to log errors against
      directory - The path taken through the config to get to this point, for logging purposes
  • Method Details

    • buildGenerator

      public static VectorGenerator buildGenerator(String typeString, org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory)
      Get a VectorGenerator based on a configuration section
      Parameters:
      typeString - The name of the generator type
      section - The section to read from
      settings - The settings to log errors against
      directory - The path taken through the config to get to this point, for logging purposes
      Returns:
      The built VectorGenerator
    • getNewValue

      protected abstract org.bukkit.util.Vector getNewValue()
    • writeToConfig

      public abstract void writeToConfig(org.bukkit.configuration.ConfigurationSection section, String path)
      Save this generator in a config that can be read by its constructor
      Specified by:
      writeToConfig in interface Provider
      Parameters:
      section - The section to write to
      path - The field/path inside the given section
    • refresh

      public final void refresh()
      Generate a new value
      Specified by:
      refresh in interface Refreshable
    • refreshInternal

      protected void refreshInternal()
    • getValue

      public org.bukkit.util.Vector getValue()
      Returns:
      A clone of the most recently generated value
    • clone

      public abstract VectorGenerator clone()
      Overrides:
      clone in class Object