Skip to content

Commit

Permalink
Add shane's extra special one-line creation & registration (50% off t…
Browse files Browse the repository at this point in the history
…oday only!) method.
  • Loading branch information
Moderocky committed Apr 11, 2024
1 parent ebbea3c commit 8ed6bf5
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ public void register(SkriptAddon addon, Experiment experiment) {
this.experiments.add(experiment);
}

/**
* Creates (and registers) a new experimental feature flag, which will be available to scripts
* with the {@code using %name%} structure.
* @param addon The source of this feature.
* @param codeName The debug 'code name' of this feature.
* @param phase The stability of this feature.
* @param patterns What the user may write to match the feature. Defaults to the codename if not set.
* @return An experiment flag.
*/
public Experiment register(SkriptAddon addon, String codeName, LifeCycle phase, String... patterns) {
Experiment experiment = Experiment.constant(codeName, phase, patterns);
this.register(addon, experiment);
return experiment;
}

@Override
public boolean hasExperiment(Experiment experiment) {
return experiments.contains(experiment);
Expand Down

0 comments on commit 8ed6bf5

Please sign in to comment.