mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-01-23 15:21:20 +01:00
calculateListingFee using actual listing fee if not using percentage option
Took 7 minutes
This commit is contained in:
parent
fa67b63213
commit
e8798fc18b
@ -5,8 +5,8 @@ import ca.tweetzy.auctionhouse.api.events.AuctionStartEvent;
|
||||
import ca.tweetzy.auctionhouse.api.hook.MMOItemsHook;
|
||||
import ca.tweetzy.auctionhouse.api.hook.McMMOHook;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
|
||||
import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.helpers.MaterialCategorizer;
|
||||
import ca.tweetzy.auctionhouse.managers.SoundManager;
|
||||
@ -605,27 +605,27 @@ public class AuctionAPI {
|
||||
}
|
||||
|
||||
private double calculateListingFee(double basePrice) {
|
||||
return Settings.TAX_LISTING_FEE_PERCENTAGE.getBoolean() ? (Settings.TAX_LISTING_FEE.getDouble() /100D) * basePrice : basePrice;
|
||||
return Settings.TAX_LISTING_FEE_PERCENTAGE.getBoolean() ? (Settings.TAX_LISTING_FEE.getDouble() / 100D) * basePrice : Settings.TAX_LISTING_FEE.getDouble();
|
||||
}
|
||||
|
||||
public void listAuction(Player seller, ItemStack original, ItemStack item, int seconds, double basePrice, double bidStartPrice, double bidIncPrice, double currentPrice, boolean isBiddingItem, boolean isUsingBundle, boolean requiresHandRemove) {
|
||||
listAuction(seller, original, item, seconds, basePrice, bidStartPrice, bidIncPrice, currentPrice, isBiddingItem, isUsingBundle, requiresHandRemove, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to insert an auction into the database
|
||||
*
|
||||
* @param seller Is the player who is listing the item
|
||||
* @param item Is the item stack being listed to the auction house
|
||||
* @param original Is the original item stack (only applies if using a bundle)
|
||||
* @param seconds Is the total amount of seconds the item will be active for
|
||||
* @param basePrice Is the buy now price
|
||||
* @param bidStartPrice Is the price the bidding will start at if the item is an auction
|
||||
* @param bidIncPrice Is the default price increment for an auction
|
||||
* @param currentPrice Is the current/start price of an item
|
||||
* @param isBiddingItem States whether the item is an auction or bin item
|
||||
* @param isUsingBundle States whether the item is a bundled item
|
||||
*/
|
||||
/**
|
||||
* Used to insert an auction into the database
|
||||
*
|
||||
* @param seller Is the player who is listing the item
|
||||
* @param item Is the item stack being listed to the auction house
|
||||
* @param original Is the original item stack (only applies if using a bundle)
|
||||
* @param seconds Is the total amount of seconds the item will be active for
|
||||
* @param basePrice Is the buy now price
|
||||
* @param bidStartPrice Is the price the bidding will start at if the item is an auction
|
||||
* @param bidIncPrice Is the default price increment for an auction
|
||||
* @param currentPrice Is the current/start price of an item
|
||||
* @param isBiddingItem States whether the item is an auction or bin item
|
||||
* @param isUsingBundle States whether the item is a bundled item
|
||||
*/
|
||||
public void listAuction(Player seller, ItemStack original, ItemStack item, int seconds, double basePrice, double bidStartPrice, double bidIncPrice, double currentPrice, boolean isBiddingItem, boolean isUsingBundle, boolean requiresHandRemove, boolean isInfinite) {
|
||||
if (McMMOHook.isUsingAbility(seller)) {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("general.mcmmo_ability_active").sendPrefixedMessage(seller);
|
||||
|
@ -6,13 +6,12 @@ import ca.tweetzy.auctionhouse.api.events.AuctionAdminEvent;
|
||||
import ca.tweetzy.auctionhouse.api.events.AuctionBidEvent;
|
||||
import ca.tweetzy.auctionhouse.api.events.AuctionEndEvent;
|
||||
import ca.tweetzy.auctionhouse.api.events.AuctionStartEvent;
|
||||
import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionStat;
|
||||
import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.auctionhouse.transaction.Transaction;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -32,7 +31,7 @@ public class AuctionListeners implements Listener {
|
||||
));
|
||||
|
||||
if (Settings.DISCORD_ENABLED.getBoolean() && Settings.DISCORD_ALERT_ON_AUCTION_START.getBoolean()) {
|
||||
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(AuctionHouse.getInstance(), () -> {
|
||||
AuctionHouse.newChain().async(() -> {
|
||||
Settings.DISCORD_WEBHOOKS.getStringList().forEach(hook -> {
|
||||
AuctionAPI.getInstance().sendDiscordMessage(
|
||||
hook,
|
||||
@ -44,7 +43,7 @@ public class AuctionListeners implements Listener {
|
||||
e.getAuctionItem().isBidItem()
|
||||
);
|
||||
});
|
||||
}, 1L);
|
||||
}).execute();
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +65,7 @@ public class AuctionListeners implements Listener {
|
||||
e.getSaleType() == AuctionSaleType.USED_BIDDING_SYSTEM ? e.getAuctionItem().getCurrentPrice() : e.getAuctionItem().getBasePrice()
|
||||
));
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(AuctionHouse.getInstance(), () -> {
|
||||
AuctionHouse.newChain().async(() -> {
|
||||
if (Settings.RECORD_TRANSACTIONS.getBoolean()) {
|
||||
|
||||
AuctionHouse.getInstance().getDataManager().insertTransactionAsync(new Transaction(
|
||||
@ -90,15 +89,15 @@ public class AuctionListeners implements Listener {
|
||||
if (Settings.DISCORD_ENABLED.getBoolean() && Settings.DISCORD_ALERT_ON_AUCTION_FINISH.getBoolean()) {
|
||||
Settings.DISCORD_WEBHOOKS.getStringList().forEach(hook -> AuctionAPI.getInstance().sendDiscordMessage(hook, e.getOriginalOwner(), e.getBuyer(), e.getAuctionItem(), e.getSaleType(), false, e.getSaleType() == AuctionSaleType.USED_BIDDING_SYSTEM));
|
||||
}
|
||||
}, 1L);
|
||||
}).execute();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onAuctionBid(AuctionBidEvent e) {
|
||||
if (!Settings.DISCORD_ENABLED.getBoolean() && Settings.DISCORD_ALERT_ON_AUCTION_BID.getBoolean()) return;
|
||||
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(AuctionHouse.getInstance(), () -> Settings.DISCORD_WEBHOOKS.getStringList().forEach(hook -> {
|
||||
AuctionAPI.getInstance().sendDiscordBidMessage(hook, e.getAuctionedItem(), e.getNewBidAmount());
|
||||
}), 1L);
|
||||
AuctionHouse.newChain().async(() -> {
|
||||
Settings.DISCORD_WEBHOOKS.getStringList().forEach(hook -> AuctionAPI.getInstance().sendDiscordBidMessage(hook, e.getAuctionedItem(), e.getNewBidAmount()));
|
||||
}).execute();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
Loading…
Reference in New Issue
Block a user