Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions mods/bukkit/metrics/src/main/java/org/mcstats/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,17 @@ public void enable() throws IOException {
}
}

/**
* Cancels the metric task, needed so that a plugin using embedded metrics can shutdown any tasks it started properly.
*
*/
public void cancelTask() {
if (task != null) {
task.cancel();
task = null;
}
}

/**
* Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
*
Expand All @@ -298,10 +309,7 @@ public void disable() throws IOException {
}

// Disable Task, if it is running
if (task != null) {
task.cancel();
task = null;
}
this.cancelTask();
}
}

Expand Down