mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-22 05:25:11 +01:00
🎓 payment collection done
Took 3 minutes
This commit is contained in:
parent
ddae21c659
commit
74b9df8e92
@ -278,7 +278,8 @@ public class AuctionHouse extends TweetyPlugin {
|
||||
new CommandMarkChest(),
|
||||
new CommandUpload(),
|
||||
new CommandMinPrice(),
|
||||
new CommandStats()
|
||||
new CommandStats(),
|
||||
new CommandPayments()
|
||||
);
|
||||
|
||||
// Placeholder API
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -145,7 +145,6 @@ public class TickAuctionsTask extends BukkitRunnable {
|
||||
|
||||
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()) {
|
||||
instance.getLocale().getMessage("auction.itemsold")
|
||||
|
Loading…
Reference in New Issue
Block a user