diff --git a/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java b/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java index 2647b4c..3891101 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java +++ b/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java @@ -278,7 +278,8 @@ public class AuctionHouse extends TweetyPlugin { new CommandMarkChest(), new CommandUpload(), new CommandMinPrice(), - new CommandStats() + new CommandStats(), + new CommandPayments() ); // Placeholder API diff --git a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPayment.java b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPayment.java index 9761aa7..49146b8 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPayment.java +++ b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPayment.java @@ -18,6 +18,8 @@ package ca.tweetzy.auctionhouse.auction; +import ca.tweetzy.auctionhouse.AuctionHouse; +import ca.tweetzy.auctionhouse.api.AuctionAPI; import ca.tweetzy.core.hooks.EconomyManager; import lombok.AllArgsConstructor; import lombok.Getter; @@ -40,6 +42,7 @@ public final class AuctionPayment { public void pay(Player player) { - EconomyManager.withdrawBalance(player, this.amount); + EconomyManager.deposit(player, this.amount); + AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.amount)).sendPrefixedMessage(player); } } diff --git a/src/main/java/ca/tweetzy/auctionhouse/database/DataManager.java b/src/main/java/ca/tweetzy/auctionhouse/database/DataManager.java index aa90e7e..351a4b2 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/database/DataManager.java +++ b/src/main/java/ca/tweetzy/auctionhouse/database/DataManager.java @@ -628,6 +628,9 @@ public class DataManager extends DataManagerAbstract { statement.setLong(4, auctionPayment.getTime()); statement.executeUpdate(); + // insert into storage + AuctionHouse.getInstance().getPaymentsManager().addPayment(auctionPayment); + if (callback != null) { ResultSet res = fetch.executeQuery(); res.next(); diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIPaymentCollection.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIPaymentCollection.java index 30a07d6..76fe403 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIPaymentCollection.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIPaymentCollection.java @@ -71,7 +71,7 @@ public class GUIPaymentCollection extends AbstractPlaceholderGui { }).asyncLast((data) -> { pages = (int) Math.max(1, Math.ceil(AuctionHouse.getInstance().getPaymentsManager().getPaymentsByPlayer(this.player).size() / (double) 45)); setPrevPage(5, 3, getPreviousPageItem()); - setButton(5, 4, getRefreshButtonItem(), e -> draw()); +// setButton(5, 4, getRefreshButtonItem(), e -> draw()); setNextPage(5, 5, getNextPageItem()); setOnPage(e -> { draw(); diff --git a/src/main/java/ca/tweetzy/auctionhouse/tasks/TickAuctionsTask.java b/src/main/java/ca/tweetzy/auctionhouse/tasks/TickAuctionsTask.java index b7d30d4..dcdfb2b 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/tasks/TickAuctionsTask.java +++ b/src/main/java/ca/tweetzy/auctionhouse/tasks/TickAuctionsTask.java @@ -143,8 +143,7 @@ public class TickAuctionsTask extends BukkitRunnable { if (!Settings.BIDDING_TAKES_MONEY.getBoolean()) AuctionAPI.getInstance().withdrawBalance(auctionWinner, Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice + tax : finalPrice); - AuctionAPI.getInstance().depositBalance(Bukkit.getOfflinePlayer(auctionItem.getOwner()), Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice : finalPrice - tax); - + AuctionAPI.getInstance().depositBalance(Bukkit.getOfflinePlayer(auctionItem.getOwner()), Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice : finalPrice - tax); // alert seller and buyer if (Bukkit.getOfflinePlayer(auctionItem.getOwner()).isOnline()) {