fix syntax/type errors

Took 8 minutes
This commit is contained in:
Kiran Hart 2022-10-29 16:38:47 -04:00
parent 479d512736
commit b814e6bc05
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
3 changed files with 11 additions and 6 deletions

View File

@ -19,16 +19,19 @@ import java.util.List;
*/
public class CommandExpired extends AbstractCommand {
final AuctionHouse instance;
public CommandExpired() {
super(CommandType.PLAYER_ONLY, "expired");
instance = AuctionHouse.getInstance();
}
@Override
protected ReturnType runCommand(CommandSender sender, String... args) {
final Player player = (Player) sender;
if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE;
final AuctionHouse instance = AuctionHouse.getInstance();
if (instance.getAuctionPlayerManager().getPlayer(player.getUniqueId()) == null) {
instance.getLocale().newMessage(TextUtils.formatText("&cCould not find auction player instance for&f: &e" + player.getName() + "&c creating one now.")).sendPrefixedMessage(Bukkit.getConsoleSender());
instance.getAuctionPlayerManager().addPlayer(new AuctionPlayer(player));

View File

@ -12,6 +12,7 @@ import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType;
import ca.tweetzy.auctionhouse.auction.enums.AuctionStatisticType;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.auctionhouse.transaction.Transaction;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -30,7 +31,7 @@ public class AuctionListeners implements Listener {
public void onAuctionStart(AuctionStartEvent e) {
// new stat system
final Player seller = e.getSeller();
final AuctionedItem auctionedItem = e.getAuctionedItem();
final AuctionedItem auctionedItem = e.getAuctionItem();
new AuctionStatistic(seller.getUniqueId(), auctionedItem.isBidItem() ? AuctionStatisticType.CREATED_AUCTION : AuctionStatisticType.CREATED_BIN, 1).store(null);
if (Settings.DISCORD_ENABLED.getBoolean() && Settings.DISCORD_ALERT_ON_AUCTION_START.getBoolean()) {
@ -54,9 +55,9 @@ public class AuctionListeners implements Listener {
@EventHandler
public void onAuctionEnd(AuctionEndEvent e) {
// new stat system
final Player originalOwner = e.getOriginalOwner(), buyer = e.getBuyer();
final OfflinePlayer originalOwner = e.getOriginalOwner(), buyer = e.getBuyer();
final UUID originalOwnerUUID = originalOwner.getUniqueId(), buyerUUID = buyer.getUniqueId();
final AuctionedItem auctionedItem = e.getAuctionedItem();
final AuctionedItem auctionedItem = e.getAuctionItem();
new AuctionStatistic(originalOwnerUUID, auctionedItem.isBidItem() ? AuctionStatisticType.SOLD_AUCTION : AuctionStatisticType.SOLD_BIN, 1).store(null);
new AuctionStatistic(originalOwnerUUID, AuctionStatisticType.MONEY_EARNED, e.getSaleType() == AuctionSaleType.USED_BIDDING_SYSTEM ? auctionedItem.getCurrentPrice() : auctionedItem.getBasePrice()).store(null);
new AuctionStatistic(buyerUUID, AuctionStatisticType.MONEY_SPENT, e.getSaleType() == AuctionSaleType.USED_BIDDING_SYSTEM ? auctionedItem.getCurrentPrice() : auctionedItem.getBasePrice()).store(null);

View File

@ -47,7 +47,8 @@ public final class AuctionStatisticManager {
this.statistics.add(statistic);
final UUID owner = statistic.getStatOwner();
final double value = value;
final double value = statistic.getValue();
switch (statistic.getStatisticType()) {
case CREATED_AUCTION:
this.createdAuctionCount.put(owner, this.createdAuctionCount.getOrDefault(owner, 0D) + value);