Class ExperimentRegistry
java.lang.Object
org.skriptlang.skript.lang.experiment.ExperimentRegistry
- All Implemented Interfaces:
Iterable<Experiment>, Experimented, Registry<Experiment>, ViewProvider<ExperimentRegistry>
public class ExperimentRegistry
extends Object
implements Registry<Experiment>, ViewProvider<ExperimentRegistry>, Experimented
A manager for registering (and identifying) experimental feature flags.
-
Constructor Summary
ConstructorsConstructorDescriptionExperimentRegistry(Skript ignored) Deprecated, for removal: This API element is subject to removal in a future version.ExperimentRegistry(Skript skript) -
Method Summary
Modifier and TypeMethodDescription@Unmodifiable Set<Experiment> elements()@NotNull ExperimentFinds an experiment matching this name.booleanhasExperiment(String featureName) booleanhasExperiment(Experiment experiment) booleanWhether a script is using an experiment.booleanisUsing(Script script, Experiment experiment) Whether a script is using an experiment.register(SkriptAddon addon, String codeName, LifeCycle phase, String... patterns) Deprecated, for removal: This API element is subject to removal in a future version.voidregister(SkriptAddon addon, Experiment experiment) Deprecated, for removal: This API element is subject to removal in a future version.register(SkriptAddon addon, String codeName, LifeCycle phase, String... patterns) Creates (and registers) a new experimental feature flag, which will be available to scripts with theusing %name%structure.voidregister(SkriptAddon addon, Experiment experiment) Registers a new experimental feature flag, which will be available to scripts with theusing %name%structure.voidregisterAll(SkriptAddon addon, Experiment... experiments) Deprecated, for removal: This API element is subject to removal in a future version.voidregisterAll(SkriptAddon addon, Experiment... experiments) Constructs an unmodifiable view ofthis.voidunregister(SkriptAddon addon, Experiment experiment) Deprecated, for removal: This API element is subject to removal in a future version.voidunregister(SkriptAddon addon, Experiment experiment) Unregisters an experimental feature flag.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
ExperimentRegistry
-
ExperimentRegistry
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
unmodifiableView
Description copied from interface:ViewProviderConstructs an unmodifiable view ofthis.- Specified by:
unmodifiableViewin interfaceViewProvider<ExperimentRegistry>- Returns:
- An unmodifiable view of this experiment registry.
-
find
Finds an experiment matching this name. If none exist, an 'unknown' one will be created.- Parameters:
text- The text provided by the user.- Returns:
- An experiment.
-
registered
- Returns:
- All currently-registered experiments.
-
elements
- Specified by:
elementsin interfaceRegistry<Experiment>- Returns:
- An unmodifiable set containing all currently-registered experiments.
-
register
Registers a new experimental feature flag, which will be available to scripts with theusing %name%structure.- Parameters:
addon- The source of this feature.experiment- The experimental feature flag.
-
register
@Deprecated(since="2.17", forRemoval=true) public void register(SkriptAddon addon, Experiment experiment) Deprecated, for removal: This API element is subject to removal in a future version. -
registerAll
- See Also:
-
registerAll
@Deprecated(since="2.17", forRemoval=true) public void registerAll(SkriptAddon addon, Experiment... experiments) Deprecated, for removal: This API element is subject to removal in a future version. -
unregister
Unregisters an experimental feature flag. Loaded scripts currently using the flag will not have it disabled.- Parameters:
addon- The source of this feature.experiment- The experimental feature flag.
-
unregister
@Deprecated(since="2.17", forRemoval=true) public void unregister(SkriptAddon addon, Experiment experiment) Deprecated, for removal: This API element is subject to removal in a future version. -
register
Creates (and registers) a new experimental feature flag, which will be available to scripts with theusing %name%structure.- Parameters:
addon- The source of this feature.codeName- The debug 'code name' of this feature.phase- The stability of this feature.patterns- What the user may write to match the feature. Defaults to the codename if not set.- Returns:
- An experiment flag.
-
register
@Deprecated(since="2.17", forRemoval=true) public Experiment register(SkriptAddon addon, String codeName, LifeCycle phase, String... patterns) Deprecated, for removal: This API element is subject to removal in a future version. -
hasExperiment
- Specified by:
hasExperimentin interfaceExperimented- Parameters:
experiment- The experimental feature to test.- Returns:
- Whether this uses the given feature.
-
hasExperiment
- Specified by:
hasExperimentin interfaceExperimented- Parameters:
featureName- The name of the experimental feature to test.- Returns:
- Whether this has a feature with the given name.
-
isUsing
Whether a script is using an experiment.- Parameters:
script- The script to testexperiment- The experimental flag- Returns:
- Whether the script declared itself as `using X`
-
isUsing
-
ExperimentRegistry(Skript).