Skip to content

Commit

Permalink
Added "Make Skript not register tasks when disabled or disabling (Skr…
Browse files Browse the repository at this point in the history
  • Loading branch information
ALOBugTea committed Aug 31, 2024
1 parent 7e3368a commit e5ff2a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/ch/njol/skript/util/AsyncEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ protected TriggerItem walk(Event e) {
@SuppressWarnings("synthetic-access")
@Override
public void run() {
// Re-set local variables
if (localVars != null)
Variables.setLocalVariables(e, localVars);
execute(e); // Execute this effect
if (next != null) {
if (next != null && Skript.getInstance().isEnabled()) { // See https://github.com/SkriptLang/Skript/issues/3702
Bukkit.getScheduler().runTask(Skript.getInstance(), new Runnable() {
@Override
public void run() { // Walk to next item synchronously
// Re-set local variables
if (localVars != null)
Variables.setLocalVariables(e, localVars);

Object timing = null;
if (SkriptTimings.enabled()) { // getTrigger call is not free, do it only if we must
Trigger trigger = getTrigger();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/ch/njol/skript/util/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public Task(final Plugin plugin, final long delay, final boolean async) {
@SuppressWarnings("deprecation")
private void schedule(final long delay) {
assert !isAlive();
if (!Skript.getInstance().isEnabled())
return;
if (period == -1) {
if (async) {
taskID = Skript.isRunningMinecraft(1, 4, 6) ?
Expand Down

0 comments on commit e5ff2a8

Please sign in to comment.