mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-09-17 17:31:02 +02:00
7b6d7d59bd
- Added Bukkit Persistence Reimplemented by LennardF1989 - Made the plugin faster - Deleted unnecessary files (.jar size went down by 10 KB) - Added final and private keywords - Support for Bukkit's built-in permissions - Updated to newest Bukkit's standard (getFace -> getRelative)
27 lines
782 B
Java
27 lines
782 B
Java
package com.Acrobot.ChestShop.DB;
|
|
|
|
import com.Acrobot.ChestShop.ChestShop;
|
|
import com.Acrobot.ChestShop.Config.Config;
|
|
import com.Acrobot.ChestShop.Config.Property;
|
|
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author Acrobot
|
|
*/
|
|
public class Queue implements Runnable {
|
|
private static final List<Transaction> queue = new LinkedList<Transaction>();
|
|
|
|
public static void addToQueue(Transaction t) {
|
|
queue.add(t);
|
|
}
|
|
|
|
public void run() {
|
|
List<Transaction> toDelete = ChestShop.getDB().find(Transaction.class).where().lt("sec", System.currentTimeMillis() / 1000 - Config.getInteger(Property.RECORD_TIME_TO_LIVE)).findList();
|
|
ChestShop.getDB().delete(toDelete);
|
|
ChestShop.getDB().save(queue);
|
|
queue.clear();
|
|
}
|
|
}
|