package net.t2code.automatedMessages.messages; import net.t2code.automatedMessages.config.FileBuild; import net.t2code.automatedMessages.config.messages.MessagesSelect; import net.t2code.automatedMessages.objects.Message; import java.util.ArrayList; import java.util.List; import java.util.Map; public class Management { private static final List timerJobList = new ArrayList<>(); private static final List cronJobs = new ArrayList<>(); public static void start() { for (Map.Entry value : MessagesSelect.getMessageHashMap().entrySet()) { Message message = value.getValue(); if (!message.enable) continue; if (message.exactTime) { CronJob cronJob = new CronJob(message); cronJobs.add(cronJob); } else { Timer job = new Timer(message); timerJobList.add(job); } } } public static void end() { for (Timer job : timerJobList) { job.disable = true; } for (CronJob cronJob : cronJobs) { cronJob.shutdown(); } } }