From 10f3607c29edf175fa8e2cb59aceb30f069b018f Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Tue, 28 Feb 2023 23:31:50 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=9D=EF=B8=8F=20call=20AuctionHouse.get?= =?UTF-8?q?Instance().getDataManager().insertAuctionPayment(new=20AuctionP?= =?UTF-8?q?ayment(...=20in=20appropriate=20places?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Took 5 minutes --- .../ca/tweetzy/auctionhouse/AuctionHouse.java | 7 +++++++ .../ca/tweetzy/auctionhouse/api/AuctionAPI.java | 6 ++++++ .../auctionhouse/auction/AuctionPayment.java | 4 ++++ .../auctionhouse/guis/GUIActiveAuctions.java | 8 +++++--- .../auctionhouse/guis/GUIAuctionHouse.java | 6 +++++- .../ca/tweetzy/auctionhouse/guis/GUIBid.java | 6 +++++- .../auctionhouse/guis/admin/GUIAdminItem.java | 16 +++++++++++++--- .../guis/confirmation/GUIConfirmBid.java | 7 ++++++- .../guis/confirmation/GUIConfirmCancel.java | 6 +++++- .../guis/confirmation/GUIConfirmPurchase.java | 6 +++++- .../auctionhouse/helpers/AuctionCreator.java | 6 +++++- .../tweetzy/auctionhouse/settings/Settings.java | 1 + .../auctionhouse/tasks/TickAuctionsTask.java | 3 ++- 13 files changed, 69 insertions(+), 13 deletions(-) diff --git a/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java b/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java index 8b961f1..2647b4c 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java +++ b/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java @@ -110,6 +110,9 @@ public class AuctionHouse extends TweetyPlugin { @Getter private MinItemPriceManager minItemPriceManager; + @Getter + private PaymentsManager paymentsManager; + @Getter private DatabaseConnector databaseConnector; @@ -247,6 +250,10 @@ public class AuctionHouse extends TweetyPlugin { this.auctionPlayerManager = new AuctionPlayerManager(); this.auctionPlayerManager.loadPlayers(); + // payments + this.paymentsManager = new PaymentsManager(); + this.paymentsManager.loadPayments(); + // gui manager this.guiManager.init(); diff --git a/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java b/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java index a107306..8465167 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java +++ b/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java @@ -19,6 +19,7 @@ package ca.tweetzy.auctionhouse.api; import ca.tweetzy.auctionhouse.AuctionHouse; +import ca.tweetzy.auctionhouse.auction.AuctionPayment; import ca.tweetzy.auctionhouse.auction.MinItemPrice; import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper; import ca.tweetzy.auctionhouse.settings.Settings; @@ -684,6 +685,11 @@ public class AuctionAPI { } public void depositBalance(OfflinePlayer player, double amount) { + if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()){ + AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(player.getUniqueId(), amount), null); + return; + } + if (Settings.PAYMENT_HANDLE_USE_CMD.getBoolean()) { AuctionHouse.newChain().sync(() -> { Bukkit.dispatchCommand(Bukkit.getConsoleSender(), Settings.PAYMENT_HANDLE_DEPOSIT_CMD.getString().replace("%player%", player.getName()).replace("%price%", String.valueOf(amount))); diff --git a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPayment.java b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPayment.java index 3aab281..9761aa7 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPayment.java +++ b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPayment.java @@ -34,6 +34,10 @@ public final class AuctionPayment { private final double amount; private final long time; + public AuctionPayment(UUID to, double amount) { + this(UUID.randomUUID(), to, amount, System.currentTimeMillis()); + } + public void pay(Player player) { EconomyManager.withdrawBalance(player, this.amount); diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIActiveAuctions.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIActiveAuctions.java index a567d4c..53f333e 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIActiveAuctions.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIActiveAuctions.java @@ -20,6 +20,7 @@ package ca.tweetzy.auctionhouse.guis; import ca.tweetzy.auctionhouse.AuctionHouse; import ca.tweetzy.auctionhouse.api.AuctionAPI; +import ca.tweetzy.auctionhouse.auction.AuctionPayment; import ca.tweetzy.auctionhouse.auction.AuctionPlayer; import ca.tweetzy.auctionhouse.auction.AuctionedItem; import ca.tweetzy.auctionhouse.auction.enums.AuctionStackType; @@ -29,14 +30,12 @@ import ca.tweetzy.auctionhouse.managers.SoundManager; import ca.tweetzy.auctionhouse.settings.Settings; import ca.tweetzy.core.hooks.EconomyManager; import ca.tweetzy.core.utils.TextUtils; -import ca.tweetzy.core.utils.items.TItemBuilder; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.scheduler.BukkitTask; import java.util.Comparator; import java.util.List; -import java.util.Objects; import java.util.stream.Collectors; /** @@ -98,7 +97,10 @@ public class GUIActiveAuctions extends AbstractPlaceholderGui { if (Settings.BIDDING_TAKES_MONEY.getBoolean() && !item.getHighestBidder().equals(item.getOwner())) { final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(item.getHighestBidder()); - EconomyManager.deposit(oldBidder, item.getCurrentPrice()); + if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) + AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), item.getCurrentPrice()), null); + else + EconomyManager.deposit(oldBidder, item.getCurrentPrice()); if (oldBidder.isOnline()) AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(item.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer()); diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java index c0344a6..14cfbf8 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java @@ -23,6 +23,7 @@ import ca.tweetzy.auctionhouse.api.AuctionAPI; import ca.tweetzy.auctionhouse.api.events.AuctionBidEvent; import ca.tweetzy.auctionhouse.api.hook.FloodGateHook; import ca.tweetzy.auctionhouse.api.hook.PlaceholderAPIHook; +import ca.tweetzy.auctionhouse.auction.AuctionPayment; import ca.tweetzy.auctionhouse.auction.AuctionPlayer; import ca.tweetzy.auctionhouse.auction.AuctionedItem; import ca.tweetzy.auctionhouse.auction.enums.AuctionItemCategory; @@ -336,7 +337,10 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui { } if (!auctionItem.getHighestBidder().equals(auctionItem.getOwner())) { - EconomyManager.deposit(oldBidder, oldBidAmount); + if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) + AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), oldBidAmount), null); + else + EconomyManager.deposit(oldBidder, oldBidAmount); if (oldBidder.isOnline()) AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(oldBidAmount)).sendPrefixedMessage(oldBidder.getPlayer()); } diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIBid.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIBid.java index d56d41e..91d9e09 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIBid.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIBid.java @@ -21,6 +21,7 @@ package ca.tweetzy.auctionhouse.guis; import ca.tweetzy.auctionhouse.AuctionHouse; import ca.tweetzy.auctionhouse.api.AuctionAPI; import ca.tweetzy.auctionhouse.api.events.AuctionBidEvent; +import ca.tweetzy.auctionhouse.auction.AuctionPayment; import ca.tweetzy.auctionhouse.auction.AuctionPlayer; import ca.tweetzy.auctionhouse.auction.AuctionedItem; import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmBid; @@ -152,7 +153,10 @@ public class GUIBid extends AbstractPlaceholderGui { } if (!auctionItem.getHighestBidder().equals(auctionItem.getOwner())) { - EconomyManager.deposit(oldBidder, oldBidAmount); + if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) + AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), oldBidAmount), null); + else + EconomyManager.deposit(oldBidder, oldBidAmount); if (oldBidder.isOnline()) AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(oldBidAmount)).sendPrefixedMessage(oldBidder.getPlayer()); } diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/admin/GUIAdminItem.java b/src/main/java/ca/tweetzy/auctionhouse/guis/admin/GUIAdminItem.java index 05649d2..bbed8fe 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/admin/GUIAdminItem.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/admin/GUIAdminItem.java @@ -22,6 +22,7 @@ import ca.tweetzy.auctionhouse.AuctionHouse; import ca.tweetzy.auctionhouse.api.AuctionAPI; import ca.tweetzy.auctionhouse.api.events.AuctionAdminEvent; import ca.tweetzy.auctionhouse.auction.AuctionAdminLog; +import ca.tweetzy.auctionhouse.auction.AuctionPayment; import ca.tweetzy.auctionhouse.auction.AuctionPlayer; import ca.tweetzy.auctionhouse.auction.AuctionedItem; import ca.tweetzy.auctionhouse.auction.enums.AdminAction; @@ -78,7 +79,10 @@ public class GUIAdminItem extends AbstractPlaceholderGui { if (Settings.BIDDING_TAKES_MONEY.getBoolean() && !this.auctionItem.getHighestBidder().equals(this.auctionItem.getOwner())) { final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(this.auctionItem.getHighestBidder()); - EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice()); + if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) + AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), auctionItem.getCurrentPrice()), null); + else + EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice()); if (oldBidder.isOnline()) AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer()); @@ -100,7 +104,10 @@ public class GUIAdminItem extends AbstractPlaceholderGui { if (Settings.BIDDING_TAKES_MONEY.getBoolean() && !this.auctionItem.getHighestBidder().equals(this.auctionItem.getOwner())) { final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(this.auctionItem.getHighestBidder()); - EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice()); + if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) + AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), auctionItem.getCurrentPrice()), null); + else + EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice()); if (oldBidder.isOnline()) AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer()); @@ -121,7 +128,10 @@ public class GUIAdminItem extends AbstractPlaceholderGui { if (Settings.BIDDING_TAKES_MONEY.getBoolean() && !this.auctionItem.getHighestBidder().equals(this.auctionItem.getOwner())) { final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(this.auctionItem.getHighestBidder()); - EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice()); + if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) + AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), auctionItem.getCurrentPrice()), null); + else + EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice()); if (oldBidder.isOnline()) AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer()); diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmBid.java b/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmBid.java index 36f2e53..13ecf75 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmBid.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmBid.java @@ -21,6 +21,7 @@ package ca.tweetzy.auctionhouse.guis.confirmation; import ca.tweetzy.auctionhouse.AuctionHouse; import ca.tweetzy.auctionhouse.api.AuctionAPI; import ca.tweetzy.auctionhouse.api.events.AuctionBidEvent; +import ca.tweetzy.auctionhouse.auction.AuctionPayment; import ca.tweetzy.auctionhouse.auction.AuctionPlayer; import ca.tweetzy.auctionhouse.auction.AuctionedItem; import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui; @@ -146,7 +147,11 @@ public class GUIConfirmBid extends AbstractPlaceholderGui { } if (!auctionItem.getHighestBidder().equals(auctionItem.getOwner())) { - EconomyManager.deposit(oldBidder, oldBidAmount); + if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) + AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), oldBidAmount), null); + else + EconomyManager.deposit(oldBidder, oldBidAmount); + if (oldBidder.isOnline()) AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(oldBidAmount)).sendPrefixedMessage(oldBidder.getPlayer()); } diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmCancel.java b/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmCancel.java index 6e765ae..044b474 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmCancel.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmCancel.java @@ -20,6 +20,7 @@ package ca.tweetzy.auctionhouse.guis.confirmation; import ca.tweetzy.auctionhouse.AuctionHouse; import ca.tweetzy.auctionhouse.api.AuctionAPI; +import ca.tweetzy.auctionhouse.auction.AuctionPayment; import ca.tweetzy.auctionhouse.auction.AuctionPlayer; import ca.tweetzy.auctionhouse.auction.AuctionedItem; import ca.tweetzy.auctionhouse.auction.enums.AuctionStackType; @@ -72,7 +73,10 @@ public class GUIConfirmCancel extends AbstractPlaceholderGui { if (Settings.BIDDING_TAKES_MONEY.getBoolean() && !located.getHighestBidder().equals(located.getOwner())) { final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(located.getHighestBidder()); - EconomyManager.deposit(oldBidder, located.getCurrentPrice()); + if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) + AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(auctionItem.getOwner(), located.getCurrentPrice()), null); + else + EconomyManager.deposit(oldBidder, located.getCurrentPrice()); if (oldBidder.isOnline()) AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(located.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer()); diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmPurchase.java b/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmPurchase.java index cce6408..e3b6729 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmPurchase.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmPurchase.java @@ -21,6 +21,7 @@ package ca.tweetzy.auctionhouse.guis.confirmation; import ca.tweetzy.auctionhouse.AuctionHouse; import ca.tweetzy.auctionhouse.api.AuctionAPI; import ca.tweetzy.auctionhouse.api.events.AuctionEndEvent; +import ca.tweetzy.auctionhouse.auction.AuctionPayment; import ca.tweetzy.auctionhouse.auction.AuctionPlayer; import ca.tweetzy.auctionhouse.auction.AuctionedItem; import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType; @@ -182,7 +183,10 @@ public class GUIConfirmPurchase extends AbstractPlaceholderGui { if (Settings.BIDDING_TAKES_MONEY.getBoolean() && !located.getHighestBidder().equals(located.getOwner())) { final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(located.getHighestBidder()); - EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice()); + if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) + AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), auctionItem.getCurrentPrice()), null); + else + EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice()); if (oldBidder.isOnline()) AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(located.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer()); diff --git a/src/main/java/ca/tweetzy/auctionhouse/helpers/AuctionCreator.java b/src/main/java/ca/tweetzy/auctionhouse/helpers/AuctionCreator.java index ce7b94a..929c068 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/helpers/AuctionCreator.java +++ b/src/main/java/ca/tweetzy/auctionhouse/helpers/AuctionCreator.java @@ -23,6 +23,7 @@ import ca.tweetzy.auctionhouse.ahv3.api.ListingResult; import ca.tweetzy.auctionhouse.api.AuctionAPI; import ca.tweetzy.auctionhouse.api.events.AuctionStartEvent; import ca.tweetzy.auctionhouse.api.hook.McMMOHook; +import ca.tweetzy.auctionhouse.auction.AuctionPayment; import ca.tweetzy.auctionhouse.auction.AuctionPlayer; import ca.tweetzy.auctionhouse.auction.AuctionedItem; import ca.tweetzy.auctionhouse.managers.SoundManager; @@ -171,7 +172,10 @@ public final class AuctionCreator { // If the item could not be added for whatever reason and the tax listing fee is enabled, refund them if (Settings.TAX_ENABLED.getBoolean() && Settings.TAX_CHARGE_LISTING_FEE.getBoolean()) { - EconomyManager.deposit(seller, listingFee); + if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) + AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(seller.getUniqueId(), listingFee), null); + else + EconomyManager.deposit(seller, listingFee); AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(seller))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(listingFee)).sendPrefixedMessage(seller); } diff --git a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java index 4937959..0c8a2da 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java +++ b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java @@ -53,6 +53,7 @@ public class Settings { * BASIC SETTINGS * ===============================*/ public static final ConfigSetting SHOW_LISTING_ERROR_IN_CONSOLE = new ConfigSetting(config, "auction setting.show listing error in console", false, "If true, an exception will be thrown and shown in the console if something goes wrong during item listing"); + public static final ConfigSetting STORE_PAYMENTS_FOR_MANUAL_COLLECTION = new ConfigSetting(config, "auction setting.store payments for manual collection", false, "If true, auction house will store the payments to be manually collected rather than automatically given to the player"); public static final ConfigSetting DEFAULT_BIN_LISTING_TIME = new ConfigSetting(config, "auction setting.listings times.bin item", 86400, "The default listing time for bin items (buy only items) before they expire"); public static final ConfigSetting DEFAULT_AUCTION_LISTING_TIME = new ConfigSetting(config, "auction setting.listings times.auction item", 604800, "The default listing time for auction items before they expire"); public static final ConfigSetting INTERNAL_CREATE_DELAY = new ConfigSetting(config, "auction setting.internal create delay", 2, "How many ticks should auction house wait before actually creating the item."); diff --git a/src/main/java/ca/tweetzy/auctionhouse/tasks/TickAuctionsTask.java b/src/main/java/ca/tweetzy/auctionhouse/tasks/TickAuctionsTask.java index dcdfb2b..b7d30d4 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/tasks/TickAuctionsTask.java +++ b/src/main/java/ca/tweetzy/auctionhouse/tasks/TickAuctionsTask.java @@ -143,7 +143,8 @@ 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()) {