mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-04 17:50:13 +01:00
dc4d9961c1
- Fixed LWC, Lockette and Default protections - Added restricted signs (Changed how they work) - Added an option to use another name - Fixed a bug where default protection was initialized too many times - Disallowed players to place another chest near a shop chest - Speeded up and fixed enchantment and durability in itemstacks - Changed /iteminfo a bit - Added /chestshop reload - Added many default permission kits - Fixed dye colors - Added an option to allow towny residents place shops in their town
46 lines
1.1 KiB
Java
46 lines
1.1 KiB
Java
package com.Acrobot.ChestShop.DB;
|
|
|
|
import com.Acrobot.ChestShop.ChestShop;
|
|
import com.Acrobot.ChestShop.Config.Config;
|
|
import com.Acrobot.ChestShop.Config.Property;
|
|
|
|
import javax.persistence.OptimisticLockException;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author Acrobot
|
|
*/
|
|
public class Queue implements Runnable {
|
|
private static final ArrayList<Transaction> queue = new ArrayList<Transaction>();
|
|
|
|
public static void addToQueue(Transaction t) {
|
|
queue.add(t);
|
|
}
|
|
|
|
public void run() {
|
|
deleteOld();
|
|
|
|
ChestShop.getDB().save(queue);
|
|
queue.clear();
|
|
}
|
|
|
|
public static boolean deleteOld() {
|
|
try {
|
|
ChestShop.getDB().delete(getOld());
|
|
return true;
|
|
} catch (OptimisticLockException ex) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static List getOld() throws OptimisticLockException {
|
|
return ChestShop
|
|
.getDB()
|
|
.find(Transaction.class)
|
|
.where()
|
|
.lt("sec", System.currentTimeMillis() / 1000 - Config.getInteger(Property.RECORD_TIME_TO_LIVE))
|
|
.findList();
|
|
}
|
|
}
|