@EventHandler public static void onTransactionLogToDB(TransactionEvent event) { if (!Config.getBoolean(LOG_TO_DATABASE) && !Config.getBoolean(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(event.getOwner().getName()); transaction.setShopUser(event.getClient().getName()); transaction.setSec(System.currentTimeMillis() / 1000); transaction.setBuy(event.getTransactionType() == BUY); Queue.addToQueue(transaction); } }