package mineplex.chestConverter; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.logging.Logger; public class ChestConverter { private static ChestConverterRepository _repository = null; private static SimpleDateFormat _dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); public static void main (String args[]) { _repository = new ChestConverterRepository(); int count = 0; int batchAmount = 5000; HashMap tasks = _repository.getTaskList(); while (true) { long time = System.currentTimeMillis(); HashMap> playerMap = new HashMap>(); List taskList = _repository.getTasks(count, batchAmount); if (taskList == null || taskList.size() == 0) return; for (AccountTask task : taskList) { if (!playerMap.containsKey(task.UUID)) playerMap.put(task.UUID, new ArrayList()); playerMap.get(task.UUID).add(tasks.get(task.Task)); } _repository.incrementClients(playerMap); try { count += batchAmount; log("Natural sleep. " + batchAmount + " took " + (System.currentTimeMillis() - time) / 1000 + " seconds. Count = " + + count); Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } private static void log(String message) { System.out.println("[" + _dateFormat.format(new Date()) + "] " + message); } }