added getListingFee() to AuctionStartEvent, closes #10

Took 2 minutes
This commit is contained in:
Kiran Hart 2022-10-06 12:50:58 -04:00
parent e6f28af4a0
commit b5e7fa0720
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
2 changed files with 7 additions and 10 deletions

View File

@ -731,7 +731,7 @@ public class AuctionAPI {
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(seller))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(calculateListingFee(basePrice))).sendPrefixedMessage(seller);
}
AuctionStartEvent startEvent = new AuctionStartEvent(seller, auctionedItem);
AuctionStartEvent startEvent = new AuctionStartEvent(seller, auctionedItem, Settings.TAX_ENABLED.getBoolean() && Settings.TAX_CHARGE_LISTING_FEE.getBoolean() ? calculateListingFee(basePrice) : 0D);
Bukkit.getServer().getPluginManager().callEvent(startEvent);
if (startEvent.isCancelled()) return;

View File

@ -1,6 +1,7 @@
package ca.tweetzy.auctionhouse.api.events;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import lombok.Getter;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
@ -12,6 +13,7 @@ import org.bukkit.event.HandlerList;
* Time Created: 4:59 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
@Getter
public class AuctionStartEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@ -20,17 +22,12 @@ public class AuctionStartEvent extends Event implements Cancellable {
private Player seller;
private AuctionedItem auctionItem;
public AuctionStartEvent(Player seller, AuctionedItem auctionItem) {
private double listingTax;
public AuctionStartEvent(Player seller, AuctionedItem auctionItem, double listingTax) {
this.seller = seller;
this.auctionItem = auctionItem;
}
public Player getSeller() {
return seller;
}
public AuctionedItem getAuctionItem() {
return auctionItem;
this.listingTax = listingTax;
}
public boolean isCancelled() {