From 2e9608c0568c8edae2a0351d6fb3f7be2a996dda Mon Sep 17 00:00:00 2001 From: asofold Date: Sun, 2 Dec 2012 17:33:33 +0100 Subject: [PATCH] Add cancel method to metrics. --- .../neatmonster/nocheatplus/metrics/Metrics.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/fr/neatmonster/nocheatplus/metrics/Metrics.java b/src/fr/neatmonster/nocheatplus/metrics/Metrics.java index eed888e3..98e4ea42 100644 --- a/src/fr/neatmonster/nocheatplus/metrics/Metrics.java +++ b/src/fr/neatmonster/nocheatplus/metrics/Metrics.java @@ -635,4 +635,18 @@ public class Metrics { return true; } } + + public void cancel() { + final int taskId; + synchronized (optOutLock) { + // Is metrics not running. + taskId = this.taskId; + if (taskId < 0) + return; + this.taskId = -1; + } + // Cancel the task. + plugin.getServer().getScheduler().cancelTask(taskId); + } + } \ No newline at end of file