Package wbs.utils.util.providers
Class VectorProvider
java.lang.Object
wbs.utils.util.providers.VectorProvider
- All Implemented Interfaces:
Provider,Refreshable
Represents a vector that may either be static, or change over time
-
Constructor Summary
ConstructorsConstructorDescriptionVectorProvider(double x, double y, double z) Create a static provider using static valuesVectorProvider(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory) Create this provider from a configuration section, and log any errors against the given settings.VectorProvider(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory, @NotNull org.bukkit.util.Vector defaultVector) Create this provider from a configuration section, and log any errors against the given settings.VectorProvider(org.bukkit.util.Vector vector) Create a static vector provider with the given vectorVectorProvider(VectorGenerator generator) Create this provider with a given, pre-configured VectorGeneratorVectorProvider(NumProvider x, NumProvider y, NumProvider z) Create this vector provider with given NumProviders directlyVectorProvider(VectorProvider clone) Clone constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.ColorGet this vector as aColor, taking the int components of x y z as r g b in the range 0-255org.bukkit.ColorGet this vector as aColor, taking the doubles x y z as r g b in the range 0-1org.bukkit.ColorGet this vector as aColor, taking the doubles x y z as hue, saturation, brightness in the range 0-1intgetIntX()intgetIntY()intgetIntZ()doublegetX()doublegetY()doublegetZ()voidrefresh()Refresh the providers that make up the vector, or the generatororg.bukkit.util.Vectorval()voidwriteToConfig(org.bukkit.configuration.ConfigurationSection section, String path) Save this provider in a config that can be read by the constructor
-
Constructor Details
-
VectorProvider
Clone constructor.- Parameters:
clone- The object to clone from.
-
VectorProvider
public VectorProvider(org.bukkit.util.Vector vector) Create a static vector provider with the given vector- Parameters:
vector- The static vector to return
-
VectorProvider
Create this provider with a given, pre-configured VectorGenerator- Parameters:
generator- The VectorGenerator to generate numbers
-
VectorProvider
public VectorProvider(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory, @NotNull @NotNull org.bukkit.util.Vector defaultVector) Create this provider from a configuration section, and log any errors against the given settings.- Parameters:
section- The section containing the x, y, z values. These may be NumProviders.settings- The WbsSettings to log errors againstdirectory- The path taken through the section to reach this provider, for logging purposesdefaultVector- The default vector to use in case any NumProviders are malformed
-
VectorProvider
public VectorProvider(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory) Create this provider from a configuration section, and log any errors against the given settings.- Parameters:
section- The section containing the x, y, z values. These may be NumProviders.settings- The WbsSettings to log errors againstdirectory- The path taken through the section to reach this provider, for logging purposes
-
VectorProvider
Create this vector provider with given NumProviders directly- Parameters:
x- The x providery- The y providerz- The z provider
-
VectorProvider
public VectorProvider(double x, double y, double z) Create a static provider using static values- Parameters:
x- The x componenty- The y componentz- The z component
-
-
Method Details
-
val
public org.bukkit.util.Vector val()- Returns:
- The current value
-
getX
public double getX()- Returns:
- The current x component
-
getY
public double getY()- Returns:
- The current y component
-
getZ
public double getZ()- Returns:
- The current z component
-
getIntX
public int getIntX()- Returns:
- The current x component as an int
-
getIntY
public int getIntY()- Returns:
- The current y component as an int
-
getIntZ
public int getIntZ()- Returns:
- The current z component as an int
-
colourVal255
public org.bukkit.Color colourVal255()Get this vector as aColor, taking the int components of x y z as r g b in the range 0-255- Returns:
- The
Colorrepresented by the current vector
-
colourValDecimal
public org.bukkit.Color colourValDecimal()Get this vector as aColor, taking the doubles x y z as r g b in the range 0-1- Returns:
- The
Colorrepresented by the current vector
-
colourValHSB
public org.bukkit.Color colourValHSB()Get this vector as aColor, taking the doubles x y z as hue, saturation, brightness in the range 0-1- Returns:
- The
Colorrepresented by the current vector
-
writeToConfig
Save this provider in a config that can be read by the constructor- Specified by:
writeToConfigin interfaceProvider- Parameters:
section- The section to write topath- The field/path inside the given section
-
refresh
public void refresh()Refresh the providers that make up the vector, or the generator- Specified by:
refreshin interfaceRefreshable
-