Class VectorProvider

java.lang.Object
wbs.utils.util.providers.VectorProvider
All Implemented Interfaces:
Provider, Refreshable

public class VectorProvider extends Object implements Provider
Represents a vector that may either be static, or change over time
  • Constructor Summary

    Constructors
    Constructor
    Description
    VectorProvider(double x, double y, double z)
    Create a static provider using static values
    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.
    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 vector
    Create this provider with a given, pre-configured VectorGenerator
    Create this vector provider with given NumProviders directly
    Clone constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.Color
    Get this vector as a Color, taking the int components of x y z as r g b in the range 0-255
    org.bukkit.Color
    Get this vector as a Color, taking the doubles x y z as r g b in the range 0-1
    org.bukkit.Color
    Get this vector as a Color, taking the doubles x y z as hue, saturation, brightness in the range 0-1
    int
     
    int
     
    int
     
    double
     
    double
     
    double
     
    void
    Refresh the providers that make up the vector, or the generator
    org.bukkit.util.Vector
    val()
     
    void
    writeToConfig(org.bukkit.configuration.ConfigurationSection section, String path)
    Save this provider in a config that can be read by the constructor

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VectorProvider

      public VectorProvider(VectorProvider clone)
      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

      public VectorProvider(VectorGenerator generator)
      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 against
      directory - The path taken through the section to reach this provider, for logging purposes
      defaultVector - 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 against
      directory - The path taken through the section to reach this provider, for logging purposes
    • VectorProvider

      public VectorProvider(NumProvider x, NumProvider y, NumProvider z)
      Create this vector provider with given NumProviders directly
      Parameters:
      x - The x provider
      y - The y provider
      z - The z provider
    • VectorProvider

      public VectorProvider(double x, double y, double z)
      Create a static provider using static values
      Parameters:
      x - The x component
      y - The y component
      z - 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 a Color, taking the int components of x y z as r g b in the range 0-255
      Returns:
      The Color represented by the current vector
    • colourValDecimal

      public org.bukkit.Color colourValDecimal()
      Get this vector as a Color, taking the doubles x y z as r g b in the range 0-1
      Returns:
      The Color represented by the current vector
    • colourValHSB

      public org.bukkit.Color colourValHSB()
      Get this vector as a Color, taking the doubles x y z as hue, saturation, brightness in the range 0-1
      Returns:
      The Color represented by the current vector
    • writeToConfig

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

      public void refresh()
      Refresh the providers that make up the vector, or the generator
      Specified by:
      refresh in interface Refreshable