mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-01-08 12:57:35 +01:00
Added a sell gui, fixed bug regarding selling bid items with the buy now disabled through the command & sell menu.
This commit is contained in:
parent
5181f1cd9c
commit
2193362251
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>ca.tweetzy</groupId>
|
||||
<artifactId>auctionhouse</artifactId>
|
||||
<version>2.17.1</version>
|
||||
<version>2.18.0</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -1,10 +1,13 @@
|
||||
package ca.tweetzy.auctionhouse.auction;
|
||||
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -51,8 +54,19 @@ public class AuctionPlayer {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean isAtSellLimit() {
|
||||
return getSellLimit() - 1 < getItems(false).size();
|
||||
}
|
||||
|
||||
public int getAllowedSellTime() {
|
||||
List<Integer> possibleTimes = new ArrayList<>();
|
||||
Settings.AUCTION_TIME.getStringList().forEach(line -> {
|
||||
String[] split = line.split(":");
|
||||
if (player.hasPermission("auctionhouse.time." + split[0])) {
|
||||
possibleTimes.add(Integer.parseInt(split[1]));
|
||||
}
|
||||
});
|
||||
|
||||
return possibleTimes.size() <= 0 ? Settings.DEFAULT_AUCTION_TIME.getInt() : Math.max(Settings.DEFAULT_AUCTION_TIME.getInt(), Collections.max(possibleTimes));
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.api.events.AuctionStartEvent;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionItem;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.guis.GUISellItem;
|
||||
import ca.tweetzy.auctionhouse.helpers.MaterialCategorizer;
|
||||
import ca.tweetzy.auctionhouse.helpers.PlayerHelper;
|
||||
import ca.tweetzy.auctionhouse.managers.SoundManager;
|
||||
@ -41,7 +42,6 @@ public class CommandSell extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||
if (args.length <= 0) return ReturnType.SYNTAX_ERROR;
|
||||
Player player = (Player) sender;
|
||||
AuctionPlayer auctionPlayer = AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(player.getUniqueId());
|
||||
|
||||
@ -85,16 +85,8 @@ public class CommandSell extends AbstractCommand {
|
||||
|
||||
if (blocked) return ReturnType.FAILURE;
|
||||
|
||||
List<Integer> possibleTimes = new ArrayList<>();
|
||||
Settings.AUCTION_TIME.getStringList().forEach(line -> {
|
||||
String[] split = line.split(":");
|
||||
if (player.hasPermission("auctionhouse.time." + split[0])) {
|
||||
possibleTimes.add(Integer.parseInt(split[1]));
|
||||
}
|
||||
});
|
||||
|
||||
// get the max allowed time for this player.
|
||||
int allowedTime = possibleTimes.size() <= 0 ? Settings.DEFAULT_AUCTION_TIME.getInt() : Math.max(Settings.DEFAULT_AUCTION_TIME.getInt(), Collections.max(possibleTimes));
|
||||
int allowedTime = auctionPlayer.getAllowedSellTime();
|
||||
|
||||
// check if player is at their selling limit
|
||||
if (auctionPlayer.isAtSellLimit()) {
|
||||
@ -102,6 +94,14 @@ public class CommandSell extends AbstractCommand {
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
// open the sell menu if its 0;
|
||||
if (args.length == 0) {
|
||||
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellItem(auctionPlayer, itemToSell));
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().addItemToSellHolding(player.getUniqueId(), itemToSell);
|
||||
PlayerUtils.takeActiveItem(player, CompatibleHand.MAIN_HAND, itemToSell.getAmount());
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
// Special command arguments
|
||||
List<String> commandFlags = AuctionAPI.getInstance().getCommandFlags(args);
|
||||
List<Double> listingPrices = new ArrayList<>();
|
||||
|
@ -4,6 +4,7 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionItem;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionStackType;
|
||||
import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmCancel;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.managers.SoundManager;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
|
@ -3,6 +3,8 @@ package ca.tweetzy.auctionhouse.guis;
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.auction.*;
|
||||
import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmBid;
|
||||
import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmPurchase;
|
||||
import ca.tweetzy.auctionhouse.guis.filter.GUIFilterSelection;
|
||||
import ca.tweetzy.auctionhouse.guis.transaction.GUITransactionList;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
|
185
src/main/java/ca/tweetzy/auctionhouse/guis/GUISellItem.java
Normal file
185
src/main/java/ca/tweetzy/auctionhouse/guis/GUISellItem.java
Normal file
@ -0,0 +1,185 @@
|
||||
package ca.tweetzy.auctionhouse.guis;
|
||||
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.api.events.AuctionStartEvent;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionItem;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.helpers.MaterialCategorizer;
|
||||
import ca.tweetzy.auctionhouse.managers.SoundManager;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.gui.Gui;
|
||||
import ca.tweetzy.core.gui.events.GuiClickEvent;
|
||||
import ca.tweetzy.core.input.ChatPrompt;
|
||||
import ca.tweetzy.core.utils.NumberUtils;
|
||||
import ca.tweetzy.core.utils.PlayerUtils;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* The current file has been created by Kiran Hart
|
||||
* Date Created: June 27 2021
|
||||
* Time Created: 10:28 a.m.
|
||||
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
|
||||
*/
|
||||
|
||||
// TODO CLEAN UP THE ENTIRE PRICE UPDATE THING
|
||||
public class GUISellItem extends Gui {
|
||||
|
||||
private final AuctionPlayer auctionPlayer;
|
||||
private final ItemStack itemToBeListed;
|
||||
|
||||
private double buyNowPrice;
|
||||
private double bidStartPrice;
|
||||
private double bidIncrementPrice;
|
||||
private boolean isBiddingItem;
|
||||
private boolean isAllowingBuyNow;
|
||||
|
||||
public GUISellItem(AuctionPlayer auctionPlayer, ItemStack itemToBeListed, double buyNowPrice, double bidStartPrice, double bidIncrementPrice, boolean isBiddingItem, boolean isAllowingBuyNow) {
|
||||
this.auctionPlayer = auctionPlayer;
|
||||
this.itemToBeListed = itemToBeListed;
|
||||
this.buyNowPrice = buyNowPrice;
|
||||
this.bidStartPrice = bidStartPrice;
|
||||
this.bidIncrementPrice = bidIncrementPrice;
|
||||
this.isBiddingItem = isBiddingItem;
|
||||
this.isAllowingBuyNow = isAllowingBuyNow;
|
||||
setTitle(TextUtils.formatText(Settings.GUI_SELL_TITLE.getString()));
|
||||
setDefaultItem(Settings.GUI_SELL_BG_ITEM.getMaterial().parseItem());
|
||||
setUseLockedCells(true);
|
||||
setAcceptsItems(false);
|
||||
setRows(5);
|
||||
draw();
|
||||
|
||||
setOnClose(close -> {
|
||||
PlayerUtils.giveItem(close.player, AuctionHouse.getInstance().getAuctionPlayerManager().getSellHolding().get(close.player.getUniqueId()));
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().getSellHolding().remove(close.player.getUniqueId());
|
||||
});
|
||||
}
|
||||
|
||||
public GUISellItem(AuctionPlayer auctionPlayer, ItemStack itemToBeListed) {
|
||||
this(auctionPlayer, itemToBeListed, Settings.MIN_AUCTION_PRICE.getDouble(), Settings.MIN_AUCTION_INCREMENT_PRICE.getDouble(), Settings.MIN_AUCTION_START_PRICE.getDouble(), false, true);
|
||||
}
|
||||
|
||||
private void draw() {
|
||||
reset();
|
||||
|
||||
// the draw item that is being listed
|
||||
setItem(1, 4, this.itemToBeListed);
|
||||
|
||||
setButton(3, 1, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_SELL_ITEMS_BUY_NOW_ITEM.getString(), Settings.GUI_SELL_ITEMS_BUY_NOW_NAME.getString(), Settings.GUI_SELL_ITEMS_BUY_NOW_LORE.getStringList(), new HashMap<String, Object>() {{
|
||||
put("%buy_now_price%", AuctionAPI.getInstance().formatNumber(buyNowPrice));
|
||||
}}), e -> {
|
||||
e.gui.exit();
|
||||
ChatPrompt.showPrompt(AuctionHouse.getInstance(), this.auctionPlayer.getPlayer(), TextUtils.formatText(AuctionHouse.getInstance().getLocale().getMessage("prompts.enter new buy now price").getMessage()), chat -> {
|
||||
String msg = chat.getMessage();
|
||||
if (validateChatNumber(msg, Settings.MIN_AUCTION_PRICE.getDouble())) {
|
||||
// special check
|
||||
if (this.isBiddingItem && this.isAllowingBuyNow && this.buyNowPrice < this.bidStartPrice && Settings.BASE_PRICE_MUST_BE_HIGHER_THAN_BID_START.getBoolean()) {
|
||||
reopen(e);
|
||||
return;
|
||||
}
|
||||
this.buyNowPrice = Double.parseDouble(msg);
|
||||
}
|
||||
reopen(e);
|
||||
}).setOnCancel(() -> reopen(e)).setOnClose(() -> reopen(e));
|
||||
});
|
||||
|
||||
if (this.isBiddingItem) {
|
||||
setButton(3, 2, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_SELL_ITEMS_STARTING_BID_ITEM.getString(), Settings.GUI_SELL_ITEMS_STARTING_BID_NAME.getString(), Settings.GUI_SELL_ITEMS_STARTING_BID_LORE.getStringList(), new HashMap<String, Object>() {{
|
||||
put("%starting_bid_price%", AuctionAPI.getInstance().formatNumber(bidStartPrice));
|
||||
}}), e -> {
|
||||
e.gui.exit();
|
||||
ChatPrompt.showPrompt(AuctionHouse.getInstance(), this.auctionPlayer.getPlayer(), TextUtils.formatText(AuctionHouse.getInstance().getLocale().getMessage("prompts.enter new starting bid").getMessage()), chat -> {
|
||||
String msg = chat.getMessage();
|
||||
if (validateChatNumber(msg, Settings.MIN_AUCTION_START_PRICE.getDouble())) {
|
||||
this.bidStartPrice = Double.parseDouble(msg);
|
||||
}
|
||||
reopen(e);
|
||||
}).setOnCancel(() -> reopen(e)).setOnClose(() -> reopen(e));
|
||||
});
|
||||
|
||||
setButton(3, 3, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_SELL_ITEMS_BID_INC_ITEM.getString(), Settings.GUI_SELL_ITEMS_BID_INC_NAME.getString(), Settings.GUI_SELL_ITEMS_BID_INC_LORE.getStringList(), new HashMap<String, Object>() {{
|
||||
put("%bid_increment_price%", AuctionAPI.getInstance().formatNumber(bidIncrementPrice));
|
||||
}}), e -> {
|
||||
e.gui.exit();
|
||||
ChatPrompt.showPrompt(AuctionHouse.getInstance(), this.auctionPlayer.getPlayer(), TextUtils.formatText(AuctionHouse.getInstance().getLocale().getMessage("prompts.enter new bid increment").getMessage()), chat -> {
|
||||
String msg = chat.getMessage();
|
||||
if (validateChatNumber(msg, Settings.MIN_AUCTION_INCREMENT_PRICE.getDouble())) {
|
||||
this.bidIncrementPrice = Double.parseDouble(msg);
|
||||
}
|
||||
reopen(e);
|
||||
}).setOnCancel(() -> reopen(e)).setOnClose(() -> reopen(e));
|
||||
});
|
||||
|
||||
setButton(3, 6, ConfigurationItemHelper.createConfigurationItem(this.isAllowingBuyNow ? Settings.GUI_SELL_ITEMS_BUY_NOW_ENABLED_ITEM.getString() : Settings.GUI_SELL_ITEMS_BUY_NOW_DISABLED_ITEM.getString(), this.isAllowingBuyNow ? Settings.GUI_SELL_ITEMS_BUY_NOW_ENABLED_NAME.getString() : Settings.GUI_SELL_ITEMS_BUY_NOW_DISABLED_NAME.getString(), this.isAllowingBuyNow ? Settings.GUI_SELL_ITEMS_BUY_NOW_ENABLED_LORE.getStringList() : Settings.GUI_SELL_ITEMS_BUY_NOW_DISABLED_LORE.getStringList(), null), e -> {
|
||||
this.isAllowingBuyNow = !this.isAllowingBuyNow;
|
||||
draw();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
setButton(3, 5, ConfigurationItemHelper.createConfigurationItem(this.isBiddingItem ? Settings.GUI_SELL_ITEMS_BIDDING_ENABLED_ITEM.getString() : Settings.GUI_SELL_ITEMS_BIDDING_DISABLED_ITEM.getString(), this.isBiddingItem ? Settings.GUI_SELL_ITEMS_BIDDING_ENABLED_NAME.getString() : Settings.GUI_SELL_ITEMS_BIDDING_DISABLED_NAME.getString(), this.isBiddingItem ? Settings.GUI_SELL_ITEMS_BIDDING_ENABLED_LORE.getStringList() : Settings.GUI_SELL_ITEMS_BIDDING_DISABLED_LORE.getStringList(), null), e -> {
|
||||
this.isBiddingItem = !this.isBiddingItem;
|
||||
draw();
|
||||
});
|
||||
|
||||
setButton(3, 7, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_SELL_ITEMS_CONFIRM_LISTING_ITEM.getString(), Settings.GUI_SELL_ITEMS_CONFIRM_LISTING_NAME.getString(), Settings.GUI_SELL_ITEMS_CONFIRM_LISTING_LORE.getStringList(), null), e -> {
|
||||
AuctionItem auctionItem = new AuctionItem(
|
||||
e.player.getUniqueId(),
|
||||
e.player.getUniqueId(),
|
||||
this.itemToBeListed,
|
||||
MaterialCategorizer.getMaterialCategory(itemToBeListed),
|
||||
UUID.randomUUID(),
|
||||
this.isBiddingItem && !isAllowingBuyNow ? -1 : buyNowPrice,
|
||||
this.isBiddingItem ? bidStartPrice : 0,
|
||||
this.isBiddingItem ? bidIncrementPrice : 0,
|
||||
this.isBiddingItem ? bidStartPrice : buyNowPrice,
|
||||
this.auctionPlayer.getAllowedSellTime(),
|
||||
false
|
||||
);
|
||||
|
||||
AuctionStartEvent auctionStartEvent = new AuctionStartEvent(e.player, auctionItem);
|
||||
Bukkit.getServer().getPluginManager().callEvent(auctionStartEvent);
|
||||
if (auctionStartEvent.isCancelled()) return;
|
||||
|
||||
AuctionHouse.getInstance().getAuctionItemManager().addItem(auctionItem);
|
||||
SoundManager.getInstance().playSound(e.player, Settings.SOUNDS_LISTED_ITEM_ON_AUCTION_HOUSE.getString(), 1.0F, 1.0F);
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().removeItemFromSellHolding(e.player.getUniqueId());
|
||||
e.gui.exit();
|
||||
|
||||
// TODO FIGURE OUT WHY THE HELL THIS IS NOT WORKING
|
||||
String NAX = AuctionHouse.getInstance().getLocale().getMessage("auction.biditemwithdisabledbuynow").getMessage();
|
||||
|
||||
AuctionHouse.getInstance().getLocale().getMessage(isBiddingItem ? "auction.listed.withbid" : "auction.listed.nobid")
|
||||
.processPlaceholder("player", e.player.getName())
|
||||
.processPlaceholder("amount", itemToBeListed.getAmount())
|
||||
.processPlaceholder("item", AuctionAPI.getInstance().getItemName(itemToBeListed))
|
||||
.processPlaceholder("base_price", !isAllowingBuyNow ? NAX : AuctionAPI.getInstance().formatNumber(buyNowPrice))
|
||||
.processPlaceholder("start_price", isBiddingItem ? AuctionAPI.getInstance().formatNumber(bidStartPrice) : 0)
|
||||
.processPlaceholder("increment_price", isBiddingItem ? AuctionAPI.getInstance().formatNumber(bidIncrementPrice) : 0).sendPrefixedMessage(e.player);
|
||||
|
||||
if (Settings.BROADCAST_AUCTION_LIST.getBoolean()) {
|
||||
Bukkit.getOnlinePlayers().forEach(AuctionHouse.getInstance().getLocale().getMessage(isBiddingItem ? "auction.listed.withbid" : "auction.broadcast.nobid")
|
||||
.processPlaceholder("player", e.player.getName())
|
||||
.processPlaceholder("amount", itemToBeListed.getAmount())
|
||||
.processPlaceholder("item", AuctionAPI.getInstance().getItemName(itemToBeListed))
|
||||
.processPlaceholder("base_price", !isAllowingBuyNow ? NAX : AuctionAPI.getInstance().formatNumber(buyNowPrice))
|
||||
.processPlaceholder("start_price", isBiddingItem ? AuctionAPI.getInstance().formatNumber(bidStartPrice) : 0)
|
||||
.processPlaceholder("increment_price", isBiddingItem ? AuctionAPI.getInstance().formatNumber(bidIncrementPrice) : 0)::sendPrefixedMessage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean validateChatNumber(String input, double requirement) {
|
||||
return input != null && input.length() != 0 && NumberUtils.isDouble(input) && Double.parseDouble(input) >= requirement;
|
||||
}
|
||||
|
||||
private void reopen(GuiClickEvent e) {
|
||||
e.manager.showGUI(e.player, new GUISellItem(this.auctionPlayer, this.itemToBeListed, this.buyNowPrice, this.bidStartPrice, this.bidIncrementPrice, this.isBiddingItem, this.isAllowingBuyNow));
|
||||
}
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
package ca.tweetzy.auctionhouse.guis;
|
||||
package ca.tweetzy.auctionhouse.guis.confirmation;
|
||||
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionItem;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.gui.Gui;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
@ -1,9 +1,10 @@
|
||||
package ca.tweetzy.auctionhouse.guis;
|
||||
package ca.tweetzy.auctionhouse.guis.confirmation;
|
||||
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionItem;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionStackType;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIActiveAuctions;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.gui.Gui;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
@ -1,4 +1,4 @@
|
||||
package ca.tweetzy.auctionhouse.guis;
|
||||
package ca.tweetzy.auctionhouse.guis.confirmation;
|
||||
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
@ -7,6 +7,7 @@ import ca.tweetzy.auctionhouse.auction.AuctionItem;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionSaleType;
|
||||
import ca.tweetzy.auctionhouse.exception.ItemNotFoundException;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.managers.SoundManager;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
@ -48,7 +48,8 @@ public class PlayerListeners implements Listener {
|
||||
Player player = e.getPlayer();
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().removePlayer(player.getUniqueId());
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().getCooldowns().remove(player.getUniqueId());
|
||||
AuctionHouse.getInstance().getLogger().info("Removing Auction Player and Cooldown instances for user: " + player.getName());
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().getSellHolding().remove(player.getUniqueId());
|
||||
AuctionHouse.getInstance().getLogger().info("Removing Instances for user: " + player.getName());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -3,6 +3,7 @@ package ca.tweetzy.auctionhouse.managers;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -17,6 +18,7 @@ import java.util.*;
|
||||
public class AuctionPlayerManager {
|
||||
|
||||
private final ArrayList<AuctionPlayer> auctionPlayers = new ArrayList<>();
|
||||
private final HashMap<UUID, ItemStack> sellHolding = new HashMap<>();
|
||||
private final HashMap<UUID, Long> cooldowns = new HashMap<>();
|
||||
|
||||
public void addPlayer(AuctionPlayer auctionPlayer) {
|
||||
@ -25,6 +27,15 @@ public class AuctionPlayerManager {
|
||||
this.auctionPlayers.add(auctionPlayer);
|
||||
}
|
||||
|
||||
public void addItemToSellHolding(UUID uuid, ItemStack itemStack) {
|
||||
if (itemStack == null) return;
|
||||
this.sellHolding.put(uuid, itemStack);
|
||||
}
|
||||
|
||||
public void removeItemFromSellHolding(UUID uuid) {
|
||||
this.sellHolding.remove(uuid);
|
||||
}
|
||||
|
||||
public void removePlayer(UUID uuid) {
|
||||
this.auctionPlayers.removeIf(player -> player.getPlayer().getUniqueId().equals(uuid));
|
||||
}
|
||||
|
@ -49,6 +49,10 @@ public class LocaleSettings {
|
||||
languageNodes.put("pricing.moneyremove", "&c&l- $%price%");
|
||||
languageNodes.put("pricing.moneyadd", "&a&l+ $%price%");
|
||||
|
||||
languageNodes.put("prompts.enter new buy now price", "&aPlease enter the new buy now price in chat:");
|
||||
languageNodes.put("prompts.enter new starting bid", "&aPlease enter the new starting bid in chat:");
|
||||
languageNodes.put("prompts.enter new bid increment", "&aPlease enter the new bid increment in chat:");
|
||||
|
||||
languageNodes.put("transaction.sale_type.bid_won", "Won Auction");
|
||||
languageNodes.put("transaction.sale_type.immediate_buy", "Bought Immediately");
|
||||
|
||||
@ -61,7 +65,6 @@ public class LocaleSettings {
|
||||
languageNodes.put("discord.is_bid_true", "true");
|
||||
languageNodes.put("discord.is_bid_false", "false");
|
||||
|
||||
|
||||
languageNodes.put("auction_filter.sale_types.biddable", "Biddable");
|
||||
languageNodes.put("auction_filter.sale_types.non_biddable", "Not Biddable");
|
||||
languageNodes.put("auction_filter.sale_types.both", "All");
|
||||
|
@ -581,6 +581,53 @@ public class Settings {
|
||||
public static final ConfigSetting GUI_FILTER_WHITELIST_LIST_TITLE = new ConfigSetting(config, "gui.filter whitelist list.title", "&7Filter Whitelist - &e%filter_category%");
|
||||
public static final ConfigSetting GUI_FILTER_WHITELIST_LIST_BG_ITEM = new ConfigSetting(config, "gui.filter whitelist list.bg item", XMaterial.BLACK_STAINED_GLASS_PANE.name());
|
||||
|
||||
/* ===============================
|
||||
* ITEM SELL/LIST GUI
|
||||
* ===============================*/
|
||||
public static final ConfigSetting GUI_SELL_TITLE = new ConfigSetting(config, "gui.sell.title", "&7Auction House - &eSelling Itm");
|
||||
public static final ConfigSetting GUI_SELL_BG_ITEM = new ConfigSetting(config, "gui.sell.bg item", XMaterial.BLACK_STAINED_GLASS_PANE.name());
|
||||
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BUY_NOW_ITEM = new ConfigSetting(config, "gui.sell.items.buy now.item", XMaterial.SUNFLOWER.name());
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BUY_NOW_NAME = new ConfigSetting(config, "gui.sell.items.buy now.name", "&e&lBuy Now Price");
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BUY_NOW_LORE = new ConfigSetting(config, "gui.sell.items.buy now.lore", Arrays.asList(
|
||||
"&7The current buy now price is&f: %buy_now_price%",
|
||||
"&7Click to edit the price"
|
||||
));
|
||||
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_STARTING_BID_ITEM = new ConfigSetting(config, "gui.sell.items.starting bid.item", XMaterial.SUNFLOWER.name());
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_STARTING_BID_NAME = new ConfigSetting(config, "gui.sell.items.starting bid.name", "&e&lStarting Bid Price");
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_STARTING_BID_LORE = new ConfigSetting(config, "gui.sell.items.starting bid.lore", Arrays.asList(
|
||||
"&7The starting bid price is&f: %starting_bid_price%",
|
||||
"&7Click to edit the price"
|
||||
));
|
||||
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BID_INC_ITEM = new ConfigSetting(config, "gui.sell.items.bid inc.item", XMaterial.SUNFLOWER.name());
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BID_INC_NAME = new ConfigSetting(config, "gui.sell.items.bid inc.name", "&e&lBid Increment Price");
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BID_INC_LORE = new ConfigSetting(config, "gui.sell.items.bid inc.lore", Arrays.asList(
|
||||
"&7The bid increment is&f: %bid_increment_price%",
|
||||
"&7Click to edit the price"
|
||||
));
|
||||
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_CONFIRM_LISTING_ITEM = new ConfigSetting(config, "gui.sell.items.confirm listing.item", XMaterial.LIME_STAINED_GLASS_PANE.name());
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_CONFIRM_LISTING_NAME = new ConfigSetting(config, "gui.sell.items.confirm listing.name", "&a&lConfirm Listing");
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_CONFIRM_LISTING_LORE = new ConfigSetting(config, "gui.sell.items.confirm listing.lore", Collections.singletonList("&7Click to confirm the listing of this item."));
|
||||
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BIDDING_ENABLED_ITEM = new ConfigSetting(config, "gui.sell.items.bidding enabled.item", XMaterial.LIME_DYE.name());
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BIDDING_ENABLED_NAME = new ConfigSetting(config, "gui.sell.items.bidding enabled.name", "&a&lBidding Enabled");
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BIDDING_ENABLED_LORE = new ConfigSetting(config, "gui.sell.items.bidding enabled.lore", Collections.singletonList("&7Click to &cDisable &7bidding"));
|
||||
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BIDDING_DISABLED_ITEM = new ConfigSetting(config, "gui.sell.items.bidding disabled.item", XMaterial.RED_DYE.name());
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BIDDING_DISABLED_NAME = new ConfigSetting(config, "gui.sell.items.bidding disabled.name", "&c&lBidding Disabled");
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BIDDING_DISABLED_LORE = new ConfigSetting(config, "gui.sell.items.bidding disabled.lore", Collections.singletonList("&7Click to &aEnable &7bidding"));
|
||||
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BUY_NOW_ENABLED_ITEM = new ConfigSetting(config, "gui.sell.items.buy now enabled.item", XMaterial.LIME_DYE.name());
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BUY_NOW_ENABLED_NAME = new ConfigSetting(config, "gui.sell.items.buy now enabled.name", "&a&lBuy Now Enabled");
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BUY_NOW_ENABLED_LORE = new ConfigSetting(config, "gui.sell.items.buy now enabled.lore", Collections.singletonList("&7Click to &cDisable &7buy now"));
|
||||
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BUY_NOW_DISABLED_ITEM = new ConfigSetting(config, "gui.sell.items.buy now disabled.item", XMaterial.RED_DYE.name());
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BUY_NOW_DISABLED_NAME = new ConfigSetting(config, "gui.sell.items.buy now disabled.name", "&c&lBuy Now Disabled");
|
||||
public static final ConfigSetting GUI_SELL_ITEMS_BUY_NOW_DISABLED_LORE = new ConfigSetting(config, "gui.sell.items.buy now disabled.lore", Collections.singletonList("&7Click to &aEnable &7buy now"));
|
||||
|
||||
|
||||
/* ===============================
|
||||
* AUCTION STACKS
|
||||
|
Loading…
Reference in New Issue
Block a user