File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/main/java/ch/njol/skript/lang/parser Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -518,9 +518,12 @@ public void removeExperiment(Experiment experiment) {
518518 * This is safe to retain during runtime (e.g. to defer a check) but will
519519 * not see changes, such as if a script subsequently 'uses' another experiment.
520520 *
521- * @return A snapshot of the current experiment flags in use
521+ * @return A snapshot of the current experiment flags in use,
522+ * or an empty experiment set if not {@link #isActive()}.
522523 */
523524 public Experimented experimentSnapshot () {
525+ if (!this .isActive ())
526+ return new ExperimentSet ();
524527 Script script = this .getCurrentScript ();
525528 @ Nullable ExperimentSet set = script .getData (ExperimentSet .class );
526529 if (set == null )
@@ -530,8 +533,12 @@ public Experimented experimentSnapshot() {
530533
531534 /**
532535 * Get the {@link ExperimentSet} of the current {@link Script}
536+ * @return Experiment set of {@link #getCurrentScript()},
537+ * or an empty experiment set if not {@link #isActive()}.
533538 */
534539 public ExperimentSet getExperimentSet () {
540+ if (!this .isActive ())
541+ return new ExperimentSet ();
535542 Script script = this .getCurrentScript ();
536543 ExperimentSet set = script .getData (ExperimentSet .class );
537544 if (set == null )
You can’t perform that action at this time.
0 commit comments