Class VectorGenerator
java.lang.Object
wbs.utils.util.providers.generator.vector.VectorGenerator
- All Implemented Interfaces:
Provider,Refreshable
- Direct Known Subclasses:
VectorBinaryFunctionalGenerator,VectorFunctionalGenerator,VectorGeneratorNormalise,VectorGeneratorRotate
A generator that returns a single Vector until
refresh() is called,
at which point it calculates a new value.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the subclasses of this generator. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedVectorGenerator(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory) Create this generator from a ConfigurationSection, logging errors in the given settings -
Method Summary
Modifier and TypeMethodDescriptionstatic VectorGeneratorbuildGenerator(String typeString, org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory) Get a VectorGenerator based on a configuration sectionabstract VectorGeneratorclone()protected abstract org.bukkit.util.Vectororg.bukkit.util.VectorgetValue()final voidrefresh()Generate a new valueprotected voidabstract voidwriteToConfig(org.bukkit.configuration.ConfigurationSection section, String path) Save this generator in a config that can be read by its constructor
-
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 definedsettings- The settings to log errors againstdirectory- 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 typesection- The section to read fromsettings- The settings to log errors againstdirectory- 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:
writeToConfigin interfaceProvider- Parameters:
section- The section to write topath- The field/path inside the given section
-
refresh
public final void refresh()Generate a new value- Specified by:
refreshin interfaceRefreshable
-
refreshInternal
protected void refreshInternal() -
getValue
public org.bukkit.util.Vector getValue()- Returns:
- A clone of the most recently generated value
-
clone
-