From 36d97bbcaf90ebd39efb015b93446a550b257cb8 Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Tue, 8 Jan 2013 17:45:52 -0500 Subject: [PATCH] Store the scheduler. --- .../com/gmail/nossr50/skills/archery/TrackedEntity.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java b/src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java index 1d6826b84..57d93d294 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java @@ -2,6 +2,7 @@ package com.gmail.nossr50.skills.archery; import org.bukkit.Bukkit; import org.bukkit.entity.LivingEntity; +import org.bukkit.scheduler.BukkitScheduler; import com.gmail.nossr50.mcMMO; @@ -10,10 +11,12 @@ public class TrackedEntity implements Runnable { private int arrowCount; private int previousTicksLived; private int taskId; + private BukkitScheduler scheduler; protected TrackedEntity(LivingEntity livingEntity) { this.livingEntity = livingEntity; - taskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(mcMMO.p, this, 12000, 12000); + this.scheduler = Bukkit.getScheduler(); + this.taskId = scheduler.scheduleSyncRepeatingTask(mcMMO.p, this, 12000, 12000); } //LivingEntity.isDead() isn't a reliable way to know if an entity is still active @@ -45,7 +48,7 @@ public class TrackedEntity implements Runnable { public void run() { if (!isActive()) { Archery.removeFromTracker(this); - Bukkit.getScheduler().cancelTask(taskId); + scheduler.cancelTask(taskId); } } }