From b5e7fa0720e55c3598ef434a6b10938f66f24a4d Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Thu, 6 Oct 2022 12:50:58 -0400 Subject: [PATCH] added getListingFee() to AuctionStartEvent, closes #10 Took 2 minutes --- .../ca/tweetzy/auctionhouse/api/AuctionAPI.java | 2 +- .../api/events/AuctionStartEvent.java | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java b/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java index e71aa41..f8c4b7e 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java +++ b/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java @@ -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; diff --git a/src/main/java/ca/tweetzy/auctionhouse/api/events/AuctionStartEvent.java b/src/main/java/ca/tweetzy/auctionhouse/api/events/AuctionStartEvent.java index da6d195..942ff43 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/api/events/AuctionStartEvent.java +++ b/src/main/java/ca/tweetzy/auctionhouse/api/events/AuctionStartEvent.java @@ -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() {