Check out example codes for "spigot cancel repeating task". It will help you in understanding the concepts better.

Code Example 1

int taskID;
public void startCountdown(){
	taskID = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this,new Countdown(),20L,20L);
}
public void stopCountdown(){
	Bukkit.getServer().getScheduler().cancelTask(taskID);
}
// 20L = 1 Second

Learn ReactJs, React Native from akashmittal.com