🎓 payment collection done

Took 3 minutes
This commit is contained in:
Kiran Hart 2023-03-03 13:03:37 -05:00
parent ddae21c659
commit 74b9df8e92
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
5 changed files with 11 additions and 5 deletions

View File

@ -278,7 +278,8 @@ public class AuctionHouse extends TweetyPlugin {
new CommandMarkChest(),
new CommandUpload(),
new CommandMinPrice(),
new CommandStats()
new CommandStats(),
new CommandPayments()
);
// Placeholder API

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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();

View File

@ -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()) {