mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-30 14:03:21 +01:00
Remove DB logging
This commit is contained in:
parent
cd3781c26c
commit
2cde9da196
@ -2,9 +2,6 @@ package com.Acrobot.ChestShop.Listeners.PostTransaction;
|
|||||||
|
|
||||||
import com.Acrobot.Breeze.Utils.LocationUtil;
|
import com.Acrobot.Breeze.Utils.LocationUtil;
|
||||||
import com.Acrobot.ChestShop.ChestShop;
|
import com.Acrobot.ChestShop.ChestShop;
|
||||||
import com.Acrobot.ChestShop.Configuration.Properties;
|
|
||||||
import com.Acrobot.ChestShop.DB.Queue;
|
|
||||||
import com.Acrobot.ChestShop.DB.Transaction;
|
|
||||||
import com.Acrobot.ChestShop.Events.TransactionEvent;
|
import com.Acrobot.ChestShop.Events.TransactionEvent;
|
||||||
import com.Acrobot.ChestShop.UUIDs.NameManager;
|
import com.Acrobot.ChestShop.UUIDs.NameManager;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -25,7 +22,8 @@ public class TransactionLogger implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public static void onTransaction(final TransactionEvent event) {
|
public static void onTransaction(final TransactionEvent event) {
|
||||||
ChestShop.getBukkitServer().getScheduler().runTaskAsynchronously(ChestShop.getPlugin(), new Runnable() {
|
ChestShop.getBukkitServer().getScheduler().runTaskAsynchronously(ChestShop.getPlugin(), new Runnable() {
|
||||||
@Override public void run() {
|
@Override
|
||||||
|
public void run() {
|
||||||
String template = (event.getTransactionType() == BUY ? BUY_MESSAGE : SELL_MESSAGE);
|
String template = (event.getTransactionType() == BUY ? BUY_MESSAGE : SELL_MESSAGE);
|
||||||
|
|
||||||
StringBuilder items = new StringBuilder(50);
|
StringBuilder items = new StringBuilder(50);
|
||||||
@ -45,32 +43,4 @@ public class TransactionLogger implements Listener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public static void onTransactionLogToDB(TransactionEvent event) {
|
|
||||||
if (!Properties.LOG_TO_DATABASE && !Properties.GENERATE_STATISTICS_PAGE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
double pricePerStack = event.getPrice() / event.getStock().length;
|
|
||||||
|
|
||||||
for (ItemStack item : event.getStock()) {
|
|
||||||
Transaction transaction = new Transaction();
|
|
||||||
|
|
||||||
transaction.setAmount(item.getAmount());
|
|
||||||
|
|
||||||
transaction.setItemID(item.getTypeId());
|
|
||||||
transaction.setItemDurability(item.getDurability());
|
|
||||||
|
|
||||||
transaction.setPrice((float) pricePerStack);
|
|
||||||
|
|
||||||
transaction.setShopOwner(NameManager.getUsername(event.getOwner().getUniqueId()));
|
|
||||||
transaction.setShopUser(NameManager.getUsername(event.getClient().getUniqueId()));
|
|
||||||
|
|
||||||
transaction.setSec(System.currentTimeMillis() / 1000);
|
|
||||||
transaction.setBuy(event.getTransactionType() == BUY);
|
|
||||||
|
|
||||||
Queue.addToQueue(transaction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user