Class PingPongGenerator
java.lang.Object
wbs.utils.util.providers.generator.num.DoubleGenerator
wbs.utils.util.providers.generator.num.PingPongGenerator
- All Implemented Interfaces:
Provider,Refreshable
A generator that moves between two NumProviders over a given period,
where it takes period calls to
DoubleGenerator.refresh() to go from min
to max, and then goes back from max to min over another period-
Constructor Summary
ConstructorsConstructorDescriptionPingPongGenerator(double min, double max, double period, double initialProgress) PingPongGenerator(org.bukkit.configuration.ConfigurationSection section, WbsSettings settings, String directory) Create this generator from a ConfigurationSection, logging errors in the given settingsClone constructor.PingPongGenerator(NumProvider min, NumProvider max, NumProvider period, double initialProgress) -
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
-
PingPongGenerator
Clone constructor.- Parameters:
clone- The object to clone from.
-
PingPongGenerator
public PingPongGenerator(double min, double max, double period, double initialProgress) -
PingPongGenerator
public PingPongGenerator(NumProvider min, NumProvider max, NumProvider period, double initialProgress) -
PingPongGenerator
public PingPongGenerator(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
-