Class RandomGenerator
java.lang.Object
wbs.utils.util.providers.generator.num.DoubleGenerator
wbs.utils.util.providers.generator.num.RandomGenerator
- All Implemented Interfaces:
Provider,Refreshable
A generator that returns a random value between two NumProviders
-
Constructor Summary
ConstructorsConstructorDescriptionRandomGenerator(double min, double max) RandomGenerator(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory) Create this generator from a ConfigurationSection, logging errors in the given settingsRandomGenerator(RandomGenerator clone) Clone constructor. -
Method Summary
Modifier and TypeMethodDescriptionclone()protected doubleGenerate a new value to override the current oneprotected voidAn internal method called beforeDoubleGenerator.getNewValue(), to allow implementing classes to refresh the provider in a controlled way.voidwriteToConfig(org.bukkit.configuration.ConfigurationSection section, String path) Save this provider in a config (that can often by read by its constructor)Methods inherited from class wbs.utils.util.providers.generator.num.DoubleGenerator
getValue, refresh
-
Constructor Details
-
RandomGenerator
Clone constructor.- Parameters:
clone- The object to clone from.
-
RandomGenerator
public RandomGenerator(double min, double max) -
RandomGenerator
public RandomGenerator(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
-
refreshInternal
protected void refreshInternal()Description copied from class:DoubleGeneratorAn internal method called beforeDoubleGenerator.getNewValue(), to allow implementing classes to refresh the provider in a controlled way.- Overrides:
refreshInternalin classDoubleGenerator
-
getNewValue
protected double getNewValue()Description copied from class:DoubleGeneratorGenerate a new value to override the current one- Specified by:
getNewValuein classDoubleGenerator- Returns:
- The new value
-
writeToConfig
Description copied from interface:ProviderSave this provider in a config (that can often by read by its constructor)- Specified by:
writeToConfigin interfaceProvider- Specified by:
writeToConfigin classDoubleGenerator- Parameters:
section- The section to write topath- The field/path inside the given section
-
clone
- Specified by:
clonein classDoubleGenerator
-