2013-01-10 23:12:41 +01:00
|
|
|
package com.gmail.nossr50.runnables;
|
|
|
|
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.scheduler.BukkitScheduler;
|
|
|
|
|
|
|
|
import com.gmail.nossr50.mcMMO;
|
|
|
|
|
2013-01-26 23:01:55 +01:00
|
|
|
public class MobStoreCleaner implements Runnable {
|
2013-01-10 23:12:41 +01:00
|
|
|
private int taskID;
|
|
|
|
|
2013-01-26 23:01:55 +01:00
|
|
|
public MobStoreCleaner() {
|
2013-01-10 23:12:41 +01:00
|
|
|
taskID = -1;
|
|
|
|
start();
|
|
|
|
}
|
|
|
|
|
2013-01-26 23:01:55 +01:00
|
|
|
public void start() {
|
|
|
|
if (taskID >= 0) {
|
2013-01-10 23:12:41 +01:00
|
|
|
return;
|
2013-01-26 23:01:55 +01:00
|
|
|
}
|
2013-01-10 23:12:41 +01:00
|
|
|
|
|
|
|
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
|
|
|
|
taskID = scheduler.scheduleSyncRepeatingTask(mcMMO.p, this, 12000, 12000);
|
|
|
|
}
|
|
|
|
|
2013-01-26 23:01:55 +01:00
|
|
|
public void stop() {
|
|
|
|
if (taskID < 0) {
|
2013-01-10 23:12:41 +01:00
|
|
|
return;
|
2013-01-26 23:01:55 +01:00
|
|
|
}
|
2013-01-10 23:12:41 +01:00
|
|
|
|
|
|
|
Bukkit.getServer().getScheduler().cancelTask(taskID);
|
|
|
|
taskID = -1;
|
|
|
|
}
|
|
|
|
|
2013-01-21 23:22:54 +01:00
|
|
|
@Override
|
2013-01-26 23:01:55 +01:00
|
|
|
public void run() {
|
2013-01-14 06:27:30 +01:00
|
|
|
mcMMO.placeStore.cleanMobLists();
|
2013-01-10 23:12:41 +01:00
|
|
|
}
|
|
|
|
}
|