Mineplex2018-withcommit/Plugins/Mineplex.ChestConverter/src/mineplex/chestConverter/ChestConverter.java

47 lines
1.1 KiB
Java
Raw Normal View History

package mineplex.chestConverter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
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 = 5000;
while (true)
{
long time = System.currentTimeMillis();
HashMap<String, Integer> playerMap = _repository.retrieveKeyInventoryBatch(count);
if (playerMap.size() == 0)
return;
_repository.incrementClient(playerMap, false);
_repository.deleteKeys(count);
try
{
log("Natural sleep. " + count + " took " + (System.currentTimeMillis() - time) / 1000 + " seconds.");
Thread.sleep(250);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
break;
}
}
private static void log(String message)
{
System.out.println("[" + _dateFormat.format(new Date()) + "] " + message);
}
}