Class ExperimentRegistry
java.lang.Object
org.skriptlang.skript.lang.experiment.ExperimentRegistry
- All Implemented Interfaces:
Experimented
A manager for registering (and identifying) experimental feature flags.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull Experiment
Finds an experiment matching this name.boolean
hasExperiment
(String featureName) boolean
hasExperiment
(Experiment experiment) boolean
Whether a script is using an experiment.boolean
isUsing
(Script script, Experiment experiment) Whether a script is using an experiment.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.void
register
(SkriptAddon addon, Experiment experiment) Registers a new experimental feature flag, which will be available to scripts with theusing %name%
structure.void
registerAll
(SkriptAddon addon, Experiment... experiments) void
unregister
(SkriptAddon addon, Experiment experiment) Unregisters an experimental feature flag.
-
Constructor Details
-
ExperimentRegistry
-
-
Method Details
-
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.
-
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.
-
registerAll
- See Also:
-
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.
-
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.
-
hasExperiment
- Specified by:
hasExperiment
in interfaceExperimented
- Parameters:
experiment
- The experimental feature to test.- Returns:
- Whether this uses the given feature.
-
hasExperiment
- Specified by:
hasExperiment
in 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
Whether a script is using an experiment.- Parameters:
script
- The script to testfeatureName
- The experimental flag's name- Returns:
- Whether the script declared itself as `using X`
-