🌟 used new currency system. Prep for multi currency support, updated inv check on join

Took 1 hour 2 minutes
This commit is contained in:
Kiran Hart 2024-08-01 14:54:51 -04:00
parent 5925d7134e
commit d35dcaf4c6
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
66 changed files with 812 additions and 410 deletions

View File

@ -24,10 +24,10 @@ import ca.tweetzy.auctionhouse.database.DataManager;
import ca.tweetzy.auctionhouse.database.migrations.*;
import ca.tweetzy.auctionhouse.helpers.UpdateChecker;
import ca.tweetzy.auctionhouse.hooks.PlaceholderAPIHook;
import ca.tweetzy.auctionhouse.hooks.UltraEconomyHook;
import ca.tweetzy.auctionhouse.listeners.*;
import ca.tweetzy.auctionhouse.managers.*;
import ca.tweetzy.auctionhouse.model.manager.BanManager;
import ca.tweetzy.auctionhouse.model.manager.CurrencyManager;
import ca.tweetzy.auctionhouse.model.manager.PaymentsManager;
import ca.tweetzy.auctionhouse.settings.LocaleSettings;
import ca.tweetzy.auctionhouse.settings.Settings;
@ -40,9 +40,6 @@ import ca.tweetzy.core.commands.CommandManager;
import ca.tweetzy.core.compatibility.ServerProject;
import ca.tweetzy.core.configuration.Config;
import ca.tweetzy.core.gui.GuiManager;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.core.hooks.PluginHook;
import ca.tweetzy.core.hooks.economies.Economy;
import ca.tweetzy.core.utils.Metrics;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.flight.comp.enums.ServerVersion;
@ -53,9 +50,11 @@ import co.aikar.taskchain.TaskChain;
import co.aikar.taskchain.TaskChainFactory;
import lombok.Getter;
import lombok.Setter;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import java.io.File;
import java.io.IOException;
@ -75,62 +74,47 @@ import java.util.stream.Collectors;
public class AuctionHouse extends TweetyPlugin {
//==========================================================================//
// "v3" stuff for organization
@Getter
private static TweetzyYamlConfig migrationCoreConfig;
private DatabaseConnector databaseConnector;
private DataManager dataManager;
private final CurrencyManager currencyManager = new CurrencyManager();
private final CommandManager commandManager = new CommandManager(this);
private final GuiManager guiManager = new GuiManager(this);
private final AuctionPlayerManager auctionPlayerManager = new AuctionPlayerManager();
private final AuctionItemManager auctionItemManager = new AuctionItemManager();
private final TransactionManager transactionManager = new TransactionManager();
private final FilterManager filterManager = new FilterManager();
private final BanManager banManager = new BanManager();
private final AuctionStatisticManager auctionStatisticManager = new AuctionStatisticManager();
private final MinItemPriceManager minItemPriceManager = new MinItemPriceManager();
private final PaymentsManager paymentsManager = new PaymentsManager();
// the default vault economy
private Economy economy = null;
//==========================================================================//
private static TaskChainFactory taskChainFactory;
private static AuctionHouse instance;
private PluginHook ultraEconomyHook;
@Getter
@Setter
private boolean migrating = false;
@Getter
private final GuiManager guiManager = new GuiManager(this);
protected Metrics metrics;
@Getter
private CommandManager commandManager;
@Getter
private AuctionPlayerManager auctionPlayerManager;
@Getter
private AuctionItemManager auctionItemManager;
@Getter
private TransactionManager transactionManager;
@Getter
private FilterManager filterManager;
@Getter
private BanManager banManager;
@Getter
private AuctionStatisticManager auctionStatisticManager;
@Getter
private MinItemPriceManager minItemPriceManager;
@Getter
private PaymentsManager paymentsManager;
@Getter
private DatabaseConnector databaseConnector;
@Getter
private DataManager dataManager;
@Getter
private UpdateChecker.UpdateStatus status;
@Override
public void onPluginLoad() {
instance = this;
}
@Override
@ -145,64 +129,18 @@ public class AuctionHouse extends TweetyPlugin {
taskChainFactory = BukkitTaskChainFactory.create(this);
migrationCoreConfig = new TweetzyYamlConfig(this, "migration-config-dont-touch.yml");
// Settings
// Settings & Locale
Settings.setup();
if (Settings.AUTO_BSTATS.getBoolean()) {
final File file = new File("plugins" + File.separator + "bStats" + File.separator + "config.yml");
if (file.exists()) {
final YamlConfiguration configuration = YamlConfiguration.loadConfiguration(file);
configuration.set("enabled", true);
try {
configuration.save(file);
} catch (IOException e) {
e.printStackTrace();
}
}
}
this.ultraEconomyHook = PluginHook.addHook(Economy.class, "UltraEconomy", UltraEconomyHook.class);
// translations & Settings migration stuff
Translations.init();
ca.tweetzy.auctionhouse.settings.v3.Settings.init();
// Load Economy
EconomyManager.load();
// local
setLocale(Settings.LANG.getString());
LocaleSettings.setup();
initializeBStats();
// Setup Economy
final String ECO_PLUGIN = Settings.ECONOMY_PLUGIN.getString();
// settings / locales v3
Translations.init();
ca.tweetzy.auctionhouse.settings.v3.Settings.init();
if (ECO_PLUGIN.startsWith("UltraEconomy")) {
EconomyManager.getManager().setPreferredHook(this.ultraEconomyHook);
} else {
EconomyManager.getManager().setPreferredHook(ECO_PLUGIN);
}
if (!EconomyManager.getManager().isEnabled()) {
getLogger().severe("Could not find a valid economy provider for Auction House");
getServer().getPluginManager().disablePlugin(this);
return;
}
// listeners
Bukkit.getServer().getPluginManager().registerEvents(new PlayerListeners(), this);
Bukkit.getServer().getPluginManager().registerEvents(new MeteorClientListeners(), this);
Bukkit.getServer().getPluginManager().registerEvents(new AuctionListeners(), this);
if (getServer().getPluginManager().isPluginEnabled("ChestShop"))
Bukkit.getServer().getPluginManager().registerEvents(new ChestShopListener(), this);
if (getServer().getPluginManager().isPluginEnabled("CMI"))
Bukkit.getServer().getPluginManager().registerEvents(new CMIListener(), this);
// Setup the database if enabled
this.databaseConnector = Settings.DATABASE_USE.getBoolean() ? new MySQLConnector(
this,
@ -245,44 +183,38 @@ public class AuctionHouse extends TweetyPlugin {
dataMigrationManager.runMigrations();
// load auction items
this.auctionItemManager = new AuctionItemManager();
this.auctionItemManager.start();
// load transactions
this.transactionManager = new TransactionManager();
this.transactionManager.loadTransactions();
// load the filter whitelist items
this.filterManager = new FilterManager();
this.filterManager.loadItems();
// load the bans
this.banManager = new BanManager();
this.banManager.load();
this.minItemPriceManager = new MinItemPriceManager();
this.minItemPriceManager.loadMinPrices();
this.auctionStatisticManager = new AuctionStatisticManager();
this.auctionStatisticManager.loadStatistics();
// auction players
this.auctionPlayerManager = new AuctionPlayerManager();
this.auctionPlayerManager.loadPlayers();
// payments
this.paymentsManager = new PaymentsManager();
this.paymentsManager.load();
// setup Vault Economy
setupEconomy(); // todo auto apply ultra economy currency if it was used.
// gui manager
this.guiManager.init();
this.banManager.load();
this.currencyManager.load();
this.paymentsManager.load();
// listeners
Bukkit.getServer().getPluginManager().registerEvents(new PlayerListeners(), this);
Bukkit.getServer().getPluginManager().registerEvents(new MeteorClientListeners(), this);
Bukkit.getServer().getPluginManager().registerEvents(new AuctionListeners(), this);
if (getServer().getPluginManager().isPluginEnabled("ChestShop"))
Bukkit.getServer().getPluginManager().registerEvents(new ChestShopListener(), this);
if (getServer().getPluginManager().isPluginEnabled("CMI"))
Bukkit.getServer().getPluginManager().registerEvents(new CMIListener(), this);
this.auctionItemManager.start();
this.transactionManager.loadTransactions();
this.filterManager.loadItems();
this.minItemPriceManager.loadMinPrices();
this.auctionStatisticManager.loadStatistics();
this.auctionPlayerManager.loadPlayers();
// commands
this.commandManager = new CommandManager(this);
this.commandManager.setSyntaxErrorMessage(TextUtils.formatText(getLocale().getMessage("commands.invalid_syntax").getMessage().split("\n")));
this.commandManager.setNoPermsMessage(TextUtils.formatText(getLocale().getMessage("commands.no_permission").getMessage()));
this.commandManager.addCommand(new CommandAuctionHouse()).addSubCommands(
this.commandManager.registerCommandDynamically(new CommandAuctionHouse()).addSubCommands(
new CommandSell(),
new CommandActive(),
new CommandExpired(),
@ -334,10 +266,6 @@ public class AuctionHouse extends TweetyPlugin {
getLogger().severe("You will not receive any support while using a non-supported jar, support jars: Spigot or Paper");
}
// if (ServerVersion.isServerVersionBelow(ServerVersion.V1_16)) {
// getLogger().severe("You are receiving this message because you're running Auction House on a Minecraft version older than 1.16. As a heads up, Auction House 3.0 is going to be for 1.16+ only");
// }
if (!ServerProject.isServer(ServerProject.PAPER, ServerProject.SPIGOT)) {
getLogger().warning("You're running Auction House on a non supported server jar, although small, there's a chance somethings will not work or just entirely break.");
}
@ -358,11 +286,26 @@ public class AuctionHouse extends TweetyPlugin {
}, 1L);
}
private void initializeBStats() {
if (Settings.AUTO_BSTATS.getBoolean()) {
final File file = new File("plugins" + File.separator + "bStats" + File.separator + "config.yml");
if (file.exists()) {
final YamlConfiguration configuration = YamlConfiguration.loadConfiguration(file);
configuration.set("enabled", true);
try {
configuration.save(file);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
@Override
public void onPluginDisable() {
if (this.dataManager != null) {
// clean up the garbage items
AuctionHouse.getInstance().getDataManager().deleteItems(AuctionHouse.getInstance().getAuctionItemManager().getDeletedItems().values().stream().map(AuctionedItem::getId).collect(Collectors.toList()));
this.dataManager.deleteItems(this.auctionItemManager.getDeletedItems().values().stream().map(AuctionedItem::getId).collect(Collectors.toList()));
this.auctionItemManager.end();
this.filterManager.saveFilterWhitelist(false);
@ -374,28 +317,14 @@ public class AuctionHouse extends TweetyPlugin {
@Override
public void onConfigReload() {
EconomyManager.load();
Settings.setup();
EconomyManager.getManager().setPreferredHook(Settings.ECONOMY_PLUGIN.getString());
setLocale(Settings.LANG.getString());
LocaleSettings.setup();
this.commandManager.setSyntaxErrorMessage(TextUtils.formatText(getLocale().getMessage("commands.invalid_syntax").getMessage().split("\n")));
this.commandManager.setNoPermsMessage(TextUtils.formatText(getLocale().getMessage("commands.no_permission").getMessage()));
}
@Override
public List<Config> getExtraConfig() {
return null;
}
public static AuctionHouse getInstance() {
return instance;
}
public static TweetzyYamlConfig getMigrationCoreConfig() {
return migrationCoreConfig;
}
//========================================== Getters ==========================================
public static <T> TaskChain<T> newChain() {
return taskChainFactory.newChain();
}
@ -404,6 +333,71 @@ public class AuctionHouse extends TweetyPlugin {
return taskChainFactory.newSharedChain(name);
}
public static AuctionHouse getInstance() {
return (AuctionHouse) TweetyPlugin.getInstance();
}
public static DataManager getDataManager() {
return getInstance().dataManager;
}
public static DatabaseConnector getDatabaseConnector() {
return getInstance().databaseConnector;
}
public static GuiManager getGuiManager() {
return getInstance().guiManager;
}
public static CommandManager getCommandManager() {
return getInstance().commandManager;
}
public static AuctionPlayerManager getAuctionPlayerManager() {
return getInstance().auctionPlayerManager;
}
public static AuctionItemManager getAuctionItemManager() {
return getInstance().auctionItemManager;
}
public static TransactionManager getTransactionManager() {
return getInstance().transactionManager;
}
public static BanManager getBanManager() {
return getInstance().banManager;
}
public static FilterManager getFilterManager() {
return getInstance().filterManager;
}
public static AuctionStatisticManager getAuctionStatisticManager() {
return getInstance().auctionStatisticManager;
}
public static MinItemPriceManager getMinItemPriceManager() {
return getInstance().minItemPriceManager;
}
public static PaymentsManager getPaymentsManager() {
return getInstance().paymentsManager;
}
public static CurrencyManager getCurrencyManager() {
return getInstance().currencyManager;
}
public static Economy getEconomy() {
return getInstance().economy;
}
//========================================== LEGACY ==========================================
@Override
public List<Config> getExtraConfig() {
return null;
}
String IS_SONGODA_DOWNLOAD = "%%__SONGODA__%%";
String SONGODA_NODE = "%%__SONGODA_NODE__%%";
@ -450,5 +444,18 @@ public class AuctionHouse extends TweetyPlugin {
}
}
// helpers
private void setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return;
}
final RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return;
}
this.economy = rsp.getProvider();
}
}

View File

@ -24,7 +24,6 @@ import ca.tweetzy.auctionhouse.auction.MinItemPrice;
import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.compatibility.XMaterial;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.flight.comp.enums.ServerVersion;
import ca.tweetzy.flight.nbtapi.NBT;
import ca.tweetzy.flight.utils.QuickItem;
@ -754,9 +753,9 @@ public class AuctionAPI {
}).execute();
} else {
if (Settings.FORCE_SYNC_MONEY_ACTIONS.getBoolean())
AuctionHouse.newChain().sync(() -> EconomyManager.withdrawBalance(player, amount)).execute();
AuctionHouse.newChain().sync(() -> AuctionHouse.getCurrencyManager().withdraw(player, amount)).execute();
else
EconomyManager.withdrawBalance(player, amount);
AuctionHouse.getCurrencyManager().withdraw(player, amount);
}
}
@ -764,14 +763,14 @@ public class AuctionAPI {
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) {
if (Settings.MANUAL_PAYMENTS_ONLY_FOR_OFFLINE_USERS.getBoolean()) {
if (!player.isOnline()) {
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(player.getUniqueId(), amount, item, paidFrom.getName(), PaymentReason.ITEM_SOLD), null);
AuctionHouse.getDataManager().insertAuctionPayment(new AuctionPayment(player.getUniqueId(), amount, item, paidFrom.getName(), PaymentReason.ITEM_SOLD), null);
} else {
initiatePayment(player, amount);
}
return;
}
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(player.getUniqueId(), amount, item, paidFrom.getName(), PaymentReason.ITEM_SOLD), null);
AuctionHouse.getDataManager().insertAuctionPayment(new AuctionPayment(player.getUniqueId(), amount, item, paidFrom.getName(), PaymentReason.ITEM_SOLD), null);
return;
}
@ -785,9 +784,9 @@ public class AuctionAPI {
}).execute();
} else {
if (Settings.FORCE_SYNC_MONEY_ACTIONS.getBoolean())
AuctionHouse.newChain().sync(() -> EconomyManager.deposit(player, amount)).execute();
AuctionHouse.newChain().sync(() -> AuctionHouse.getCurrencyManager().deposit(player, amount)).execute();
else
EconomyManager.deposit(player, amount);
AuctionHouse.getCurrencyManager().deposit(player, amount);
}
}

View File

@ -0,0 +1,20 @@
package ca.tweetzy.auctionhouse.api.currency;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@Getter
@AllArgsConstructor
public abstract class AbstractCurrency implements Chargeable {
protected String owningPlugin;
protected String currencyName;
@Setter
protected String displayName;
public String getStoreableName() {
return this.owningPlugin + "/" + this.currencyName + "/" + this.displayName;
}
}

View File

@ -0,0 +1,14 @@
package ca.tweetzy.auctionhouse.api.currency;
import org.bukkit.OfflinePlayer;
public interface Chargeable {
boolean has(OfflinePlayer player, double amount);
boolean withdraw(OfflinePlayer player, double amount);
boolean deposit(OfflinePlayer player, double amount);
double getBalance(OfflinePlayer player);
}

View File

@ -0,0 +1,17 @@
package ca.tweetzy.auctionhouse.api.currency;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.inventory.ItemStack;
@Setter
@Getter
public abstract class IconableCurrency extends AbstractCurrency {
protected ItemStack icon;
public IconableCurrency(String owningPlugin, String currencyName, String displayName, ItemStack icon) {
super(owningPlugin, currencyName, displayName);
this.icon = icon;
}
}

View File

@ -0,0 +1,4 @@
package ca.tweetzy.auctionhouse.api.currency;
public interface Payment {
}

View File

@ -0,0 +1,10 @@
package ca.tweetzy.auctionhouse.api.currency;
public enum TransactionResult {
SUCCESS,
FAILED_NO_MONEY,
FAILED_NO_LONGER_AVAILABLE,
FAILED_NOT_ENOUGH_ITEMS,
ERROR
}

View File

@ -0,0 +1,51 @@
package ca.tweetzy.auctionhouse.api.manager;
import lombok.NonNull;
import java.util.*;
public abstract class ListManager<T> extends Manager {
protected final List<T> managerContent = Collections.synchronizedList(new ArrayList<>());
public ListManager(@NonNull String name) {
super(name);
}
public Optional<T> get(@NonNull final T t) {
synchronized (this.managerContent) {
return this.managerContent.stream().filter(contents -> contents == t).findFirst();
}
}
public void add(@NonNull final T t) {
synchronized (this.managerContent) {
if (this.managerContent.contains(t)) return;
this.managerContent.add(t);
}
}
public void addAll(@NonNull final Collection<T> t) {
synchronized (this.managerContent) {
this.managerContent.addAll(t);
}
}
public void remove(@NonNull final T t) {
synchronized (this.managerContent) {
this.managerContent.remove(t);
}
}
public void clear() {
synchronized (this.managerContent) {
this.managerContent.clear();
}
}
public List<T> getManagerContent() {
synchronized (this.managerContent) {
return new ArrayList<>(this.managerContent);
}
}
}

View File

@ -33,14 +33,16 @@ public interface Statistic extends Identifiable<UUID>, Trackable, Storeable<Stat
*
* @return the {@link UUID} of the statistic owner
*/
@NonNull UUID getOwner();
@NonNull
UUID getOwner();
/**
* Get the statistic type that is being tracked
*
* @return the tracked {@link AuctionStatisticType}
*/
@NonNull AuctionStatisticType getType();
@NonNull
AuctionStatisticType getType();
/**
* The total value of this statistic

View File

@ -21,7 +21,6 @@ package ca.tweetzy.auctionhouse.auction;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.core.hooks.EconomyManager;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.entity.Player;
@ -49,7 +48,7 @@ public final class AuctionPayment {
public void pay(Player player) {
EconomyManager.deposit(player, this.amount);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.amount)).sendPrefixedMessage(player);
AuctionHouse.getCurrencyManager().deposit(player, this.amount);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.amount)).sendPrefixedMessage(player);
}
}

View File

@ -32,10 +32,8 @@ import ca.tweetzy.flight.utils.QuickItem;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;

View File

@ -36,7 +36,6 @@ import ca.tweetzy.auctionhouse.helpers.PlayerHelper;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.commands.AbstractCommand;
import ca.tweetzy.core.compatibility.XMaterial;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.core.utils.PlayerUtils;
import ca.tweetzy.core.utils.TextUtils;
import org.bukkit.Bukkit;
@ -261,7 +260,7 @@ public class CommandAdmin extends AbstractCommand {
PaymentReason.BID_RETURNED
), null);
else
EconomyManager.deposit(player, auctionedItem.getCurrentPrice());
AuctionHouse.getCurrencyManager().deposit(player, auctionedItem.getCurrentPrice());
}
}
@ -289,10 +288,10 @@ public class CommandAdmin extends AbstractCommand {
PaymentReason.ADMIN_REMOVED
), null);
else
EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());
AuctionHouse.getCurrencyManager().deposit(oldBidder, auctionItem.getCurrentPrice());
if (oldBidder.isOnline())
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
}
}

View File

@ -50,20 +50,19 @@ public class CommandAuctionHouse extends AbstractCommand {
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));
if (AuctionHouse.getAuctionPlayerManager().getPlayer(player.getUniqueId()) == null) {
AuctionHouse.getInstance().getLocale().newMessage(TextUtils.formatText("&cCould not find auction player instance for&f: &e" + player.getName() + "&c creating one now.")).sendPrefixedMessage(Bukkit.getConsoleSender());
AuctionHouse.getAuctionPlayerManager().addPlayer(new AuctionPlayer(player));
}
if (args.length == 0) {
instance.getGuiManager().showGUI(player, new GUIAuctionHouse(instance.getAuctionPlayerManager().getPlayer(player.getUniqueId())));
AuctionHouse.getGuiManager().showGUI(player, new GUIAuctionHouse(AuctionHouse.getAuctionPlayerManager().getPlayer(player.getUniqueId())));
return ReturnType.SUCCESS;
}
if (args.length == 1 && instance.getCommandManager().getSubCommands("auctionhouse").stream().noneMatch(cmd -> cmd.equalsIgnoreCase(StringUtils.join(args, ' ').trim()))) {
if (args.length == 1 && AuctionHouse.getCommandManager().getSubCommands("auctionhouse").stream().noneMatch(cmd -> cmd.equalsIgnoreCase(StringUtils.join(args, ' ').trim()))) {
if (args[0].equalsIgnoreCase("NaN")) return ReturnType.FAILURE;
instance.getGuiManager().showGUI(player, new GUIAuctionHouse(instance.getAuctionPlayerManager().getPlayer(player.getUniqueId()), StringUtils.join(args, ' ').trim()));
AuctionHouse.getGuiManager().showGUI(player, new GUIAuctionHouse(AuctionHouse.getAuctionPlayerManager().getPlayer(player.getUniqueId()), StringUtils.join(args, ' ').trim()));
}
}
return ReturnType.SUCCESS;
@ -72,7 +71,7 @@ public class CommandAuctionHouse extends AbstractCommand {
@Override
protected List<String> onTab(CommandSender sender, String... args) {
final Player player = (Player) sender;
return AuctionHouse.getInstance().getCommandManager().getAllCommands().stream().filter(cmd -> cmd.getPermissionNode() == null || player.hasPermission(cmd.getPermissionNode())).map(AbstractCommand::getSyntax).collect(Collectors.toList());
return AuctionHouse.getCommandManager().getAllCommands().stream().filter(cmd -> cmd.getPermissionNode() == null || player.hasPermission(cmd.getPermissionNode())).map(AbstractCommand::getSyntax).collect(Collectors.toList());
}
@Override

View File

@ -38,7 +38,7 @@ import java.util.stream.Collectors;
public class CommandBan extends AbstractCommand {
public CommandBan() {
super(CommandType.PLAYER_ONLY, "ban");
super(CommandType.PLAYER_ONLY, "ban");
}
@Override

View File

@ -160,7 +160,7 @@ public class DataManager extends DataManagerAbstract {
public void saveFilterWhitelist(List<AuctionFilterItem> filterItems, boolean async) {
String saveItems = "INSERT INTO " + this.getTablePrefix() + "filter_whitelist(data) VALUES(?)";
String truncate = AuctionHouse.getInstance().getDatabaseConnector() instanceof MySQLConnector ? "TRUNCATE TABLE " + this.getTablePrefix() + "filter_whitelist" : "DELETE FROM " + this.getTablePrefix() + "filter_whitelist";
String truncate = AuctionHouse.getDatabaseConnector() instanceof MySQLConnector ? "TRUNCATE TABLE " + this.getTablePrefix() + "filter_whitelist" : "DELETE FROM " + this.getTablePrefix() + "filter_whitelist";
if (async) {
this.runAsync(() -> this.databaseConnector.connect(connection -> {
@ -585,7 +585,7 @@ public class DataManager extends DataManagerAbstract {
"VALUES (?, ?, ?, ?, ?)";
if (AuctionHouse.getInstance().getDatabaseConnector() instanceof MySQLConnector) {
if (AuctionHouse.getDatabaseConnector() instanceof MySQLConnector) {
insertQuery = "INSERT INTO " + getTablePrefix() + "player " +
"(uuid, filter_sale_type, filter_item_category, filter_sort_type, last_listed_item) " +
"VALUES (?, ?, ?, ?, ?) " +

View File

@ -41,7 +41,7 @@ public final class _11_AdminLogMigration extends DataMigration {
@Override
public void migrate(Connection connection, String tablePrefix) throws SQLException {
try (Statement statement = connection.createStatement()) {
String autoIncrement = AuctionHouse.getInstance().getDatabaseConnector() instanceof MySQLConnector ? " AUTO_INCREMENT" : "";
String autoIncrement = AuctionHouse.getDatabaseConnector() instanceof MySQLConnector ? " AUTO_INCREMENT" : "";
statement.execute("CREATE TABLE IF NOT EXISTS " + tablePrefix + "admin_logs (" +

View File

@ -40,7 +40,7 @@ public class _1_InitialMigration extends DataMigration {
@Override
public void migrate(Connection connection, String tablePrefix) throws SQLException {
String autoIncrement = AuctionHouse.getInstance().getDatabaseConnector() instanceof MySQLConnector ? " AUTO_INCREMENT" : "";
String autoIncrement = AuctionHouse.getDatabaseConnector() instanceof MySQLConnector ? " AUTO_INCREMENT" : "";
try (Statement statement = connection.createStatement()) {
statement.execute("CREATE TABLE " + tablePrefix + "items (" +

View File

@ -40,7 +40,7 @@ public class _2_FilterWhitelistMigration extends DataMigration {
@Override
public void migrate(Connection connection, String tablePrefix) throws SQLException {
String autoIncrement = AuctionHouse.getInstance().getDatabaseConnector() instanceof MySQLConnector ? " AUTO_INCREMENT" : "";
String autoIncrement = AuctionHouse.getDatabaseConnector() instanceof MySQLConnector ? " AUTO_INCREMENT" : "";
try (Statement statement = connection.createStatement()) {
statement.execute("CREATE TABLE " + tablePrefix + "filter_whitelist (" +

View File

@ -40,7 +40,7 @@ public class _3_BansMigration extends DataMigration {
@Override
public void migrate(Connection connection, String tablePrefix) throws SQLException {
String autoIncrement = AuctionHouse.getInstance().getDatabaseConnector() instanceof MySQLConnector ? " AUTO_INCREMENT" : "";
String autoIncrement = AuctionHouse.getDatabaseConnector() instanceof MySQLConnector ? " AUTO_INCREMENT" : "";
try (Statement statement = connection.createStatement()) {
statement.execute("CREATE TABLE " + tablePrefix + "bans (" +

View File

@ -42,7 +42,7 @@ public class _6_BigIntMigration extends DataMigration {
public void migrate(Connection connection, String tablePrefix) throws SQLException {
try (Statement statement = connection.createStatement()) {
if (AuctionHouse.getInstance().getDatabaseConnector() instanceof MySQLConnector) {
if (AuctionHouse.getDatabaseConnector() instanceof MySQLConnector) {
statement.execute("ALTER TABLE " + tablePrefix + "auctions MODIFY COLUMN expires_at BigInt(20)");
} else {

View File

@ -42,7 +42,7 @@ public class _7_TransactionBigIntMigration extends DataMigration {
public void migrate(Connection connection, String tablePrefix) throws SQLException {
try (Statement statement = connection.createStatement()) {
if (AuctionHouse.getInstance().getDatabaseConnector() instanceof MySQLConnector) {
if (AuctionHouse.getDatabaseConnector() instanceof MySQLConnector) {
statement.execute("ALTER TABLE " + tablePrefix + "transactions MODIFY COLUMN transaction_time BigInt(20)");
} else {

View File

@ -56,7 +56,7 @@ public final class GUIAdminExpired extends AuctionPagedGUI<AuctionedItem> {
@Override
protected ItemStack makeDisplayItem(AuctionedItem auctionedItem) {
final ItemStack item = auctionedItem.getItem().clone();
return QuickItem.of(item).lore(this.player,Settings.GUI_EXPIRED_ITEMS_ADMIN_ITEMS_LORE.getStringList()).make();
return QuickItem.of(item).lore(this.player, Settings.GUI_EXPIRED_ITEMS_ADMIN_ITEMS_LORE.getStringList()).make();
}
@Override

View File

@ -30,7 +30,6 @@ import ca.tweetzy.auctionhouse.events.AuctionAdminEvent;
import ca.tweetzy.auctionhouse.guis.AuctionBaseGUI;
import ca.tweetzy.auctionhouse.guis.core.GUIAuctionHouse;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.core.utils.PlayerUtils;
import ca.tweetzy.flight.utils.QuickItem;
import org.bukkit.Bukkit;
@ -72,7 +71,7 @@ public class GUIAdminItem extends AuctionBaseGUI {
private void drawReturnButton() {
if (Settings.ADMIN_OPTION_SHOW_RETURN_ITEM.getBoolean())
setButton(1, 1, QuickItem.of(Settings.GUI_ITEM_ADMIN_ITEMS_RETURN_ITEM.getString()).name(Settings.GUI_ITEM_ADMIN_ITEMS_RETURN_NAME.getString()).lore(this.player,Settings.GUI_ITEM_ADMIN_ITEMS_RETURN_LORE.getStringList()).make(), click -> {
setButton(1, 1, QuickItem.of(Settings.GUI_ITEM_ADMIN_ITEMS_RETURN_ITEM.getString()).name(Settings.GUI_ITEM_ADMIN_ITEMS_RETURN_NAME.getString()).lore(this.player, Settings.GUI_ITEM_ADMIN_ITEMS_RETURN_LORE.getStringList()).make(), click -> {
if (!click.player.hasPermission("auctionhouse.admin.returnitem")) return;
@ -90,10 +89,10 @@ public class GUIAdminItem extends AuctionBaseGUI {
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), auctionItem.getCurrentPrice(), auctionItem.getItem(), click.player.getName(), PaymentReason.ADMIN_REMOVED), null);
else EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());
else AuctionHouse.getCurrencyManager().deposit(oldBidder, auctionItem.getCurrentPrice());
if (oldBidder.isOnline())
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
}
@ -103,7 +102,7 @@ public class GUIAdminItem extends AuctionBaseGUI {
private void drawClaimButton() {
if (Settings.ADMIN_OPTION_SHOW_CLAIM_ITEM.getBoolean())
setButton(1, 3, QuickItem.of(Settings.GUI_ITEM_ADMIN_ITEMS_CLAIM_ITEM.getString()).name(Settings.GUI_ITEM_ADMIN_ITEMS_CLAIM_NAME.getString()).lore(this.player,Settings.GUI_ITEM_ADMIN_ITEMS_CLAIM_LORE.getStringList()).make(), click -> {
setButton(1, 3, QuickItem.of(Settings.GUI_ITEM_ADMIN_ITEMS_CLAIM_ITEM.getString()).name(Settings.GUI_ITEM_ADMIN_ITEMS_CLAIM_NAME.getString()).lore(this.player, Settings.GUI_ITEM_ADMIN_ITEMS_CLAIM_LORE.getStringList()).make(), click -> {
if (!click.player.hasPermission("auctionhouse.admin.claimitem")) return;
@ -118,10 +117,10 @@ public class GUIAdminItem extends AuctionBaseGUI {
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), auctionItem.getCurrentPrice(), auctionItem.getItem(), click.player.getName(), PaymentReason.ADMIN_REMOVED), null);
else EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());
else AuctionHouse.getCurrencyManager().deposit(oldBidder, auctionItem.getCurrentPrice());
if (oldBidder.isOnline())
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
}
@ -132,7 +131,7 @@ public class GUIAdminItem extends AuctionBaseGUI {
private void drawDeleteButton() {
if (Settings.ADMIN_OPTION_SHOW_DELETE_ITEM.getBoolean())
setButton(1, 5, QuickItem.of(Settings.GUI_ITEM_ADMIN_ITEMS_DELETE_ITEM.getString()).name(Settings.GUI_ITEM_ADMIN_ITEMS_DELETE_NAME.getString()).lore(this.player,Settings.GUI_ITEM_ADMIN_ITEMS_DELETE_LORE.getStringList()).make(), click -> {
setButton(1, 5, QuickItem.of(Settings.GUI_ITEM_ADMIN_ITEMS_DELETE_ITEM.getString()).name(Settings.GUI_ITEM_ADMIN_ITEMS_DELETE_NAME.getString()).lore(this.player, Settings.GUI_ITEM_ADMIN_ITEMS_DELETE_LORE.getStringList()).make(), click -> {
if (!click.player.hasPermission("auctionhouse.admin.deleteitem")) return;
AuctionAdminEvent event = new AuctionAdminEvent(createLog(click.player, AdminAction.DELETE_ITEM));
@ -151,10 +150,10 @@ public class GUIAdminItem extends AuctionBaseGUI {
PaymentReason.ADMIN_REMOVED
), null);
else
EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());
AuctionHouse.getCurrencyManager().deposit(oldBidder, auctionItem.getCurrentPrice());
if (oldBidder.isOnline())
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
}
@ -165,7 +164,7 @@ public class GUIAdminItem extends AuctionBaseGUI {
private void drawCopyButton() {
if (Settings.ADMIN_OPTION_SHOW_COPY_ITEM.getBoolean())
setButton(1, 7, QuickItem.of(Settings.GUI_ITEM_ADMIN_ITEMS_COPY_ITEM.getString()).name(Settings.GUI_ITEM_ADMIN_ITEMS_COPY_NAME.getString()).lore(this.player,Settings.GUI_ITEM_ADMIN_ITEMS_COPY_LORE.getStringList()).make(), click -> {
setButton(1, 7, QuickItem.of(Settings.GUI_ITEM_ADMIN_ITEMS_COPY_ITEM.getString()).name(Settings.GUI_ITEM_ADMIN_ITEMS_COPY_NAME.getString()).lore(this.player, Settings.GUI_ITEM_ADMIN_ITEMS_COPY_LORE.getStringList()).make(), click -> {
if (!click.player.hasPermission("auctionhouse.admin.copyitem")) return;
if (Settings.ITEM_COPY_REQUIRES_GMC.getBoolean() && click.player.getGameMode() != GameMode.CREATIVE) {

View File

@ -60,7 +60,7 @@ public final class GUIAdminLogs extends AuctionPagedGUI<AuctionAdminLog> {
return QuickItem
.of(log.getItem())
.name(AuctionAPI.getInstance().getItemName(log.getItem()))
.lore(this.player,Replacer.replaceVariables(Settings.GUI_LOGS_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_LOGS_LORE.getStringList(),
"admin", log.getAdminName(),
"target", log.getTargetName(),
"admin_uuid", log.getAdmin(),

View File

@ -58,7 +58,7 @@ public final class GUIMinItemPrices extends AuctionPagedGUI<MinItemPrice> {
return QuickItem
.of(minItemPrice.getItemStack().clone())
.name(AuctionAPI.getInstance().getItemName(minItemPrice.getItemStack()))
.lore(this.player,Replacer.replaceVariables(lore, "price", AuctionAPI.getInstance().formatNumber(minItemPrice.getPrice())))
.lore(this.player, Replacer.replaceVariables(lore, "price", AuctionAPI.getInstance().formatNumber(minItemPrice.getPrice())))
.make();
}

View File

@ -38,7 +38,7 @@ public final class GUIBanTypeSelection extends AuctionPagedGUI<BanType> {
return QuickItem
.of(this.ban.getTypes().contains(banType) ? CompMaterial.LIME_STAINED_GLASS_PANE : CompMaterial.RED_STAINED_GLASS_PANE)
.name(Settings.GUI_BAN_TYPES_ITEMS_TYPE_NAME.getString().replace("%ban_type%", ChatUtil.capitalizeFully(banType)))
.lore(this.player,Settings.GUI_BAN_TYPES_ITEMS_TYPE_LORE.getStringList())
.lore(this.player, Settings.GUI_BAN_TYPES_ITEMS_TYPE_LORE.getStringList())
.make();
}

View File

@ -31,7 +31,7 @@ public final class GUIBanUser extends AuctionBaseGUI {
setItem(1, 4, QuickItem
.of(Bukkit.getOfflinePlayer(ban.getId()))
.name(Settings.GUI_BAN_ITEMS_PLAYER_NAME.getString().replace("%player_name%", this.ban.locatePlayer().getName()))
.lore(this.player,Settings.GUI_BAN_ITEMS_PLAYER_LORE.getStringList())
.lore(this.player, Settings.GUI_BAN_ITEMS_PLAYER_LORE.getStringList())
.make());
// types
@ -49,7 +49,7 @@ public final class GUIBanUser extends AuctionBaseGUI {
setButton(getRows() - 1, 4, QuickItem
.of(Settings.GUI_BAN_ITEMS_CREATE_ITEM.getString())
.name(Settings.GUI_BAN_ITEMS_CREATE_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_BAN_ITEMS_CREATE_LORE.getStringList()))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_BAN_ITEMS_CREATE_LORE.getStringList()))
.make(), click -> {
if (this.ban.getTypes().isEmpty()) {
@ -57,7 +57,7 @@ public final class GUIBanUser extends AuctionBaseGUI {
return;
}
AuctionHouse.getInstance().getBanManager().registerBan(this.ban, created -> {
AuctionHouse.getBanManager().registerBan(this.ban, created -> {
if (created) {
AuctionHouse.getInstance().getLocale().getMessage("ban.user banned").processPlaceholder("player_name", this.ban.locatePlayer().getName()).sendPrefixedMessage(click.player);
AuctionHouse.newChain().sync(click.gui::close).execute();
@ -70,7 +70,7 @@ public final class GUIBanUser extends AuctionBaseGUI {
setButton(3, 1, QuickItem
.of(Settings.GUI_BAN_ITEMS_TYPES_ITEM.getString())
.name(Settings.GUI_BAN_ITEMS_TYPES_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_BAN_ITEMS_TYPES_LORE.getStringList(), "ban_type_list", this.ban.getBansAsString()))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_BAN_ITEMS_TYPES_LORE.getStringList(), "ban_type_list", this.ban.getBansAsString()))
.make(), click -> click.manager.showGUI(click.player, new GUIBanTypeSelection(click.player, this.ban)));
}
@ -78,7 +78,7 @@ public final class GUIBanUser extends AuctionBaseGUI {
setButton(3, 3, QuickItem
.of(Settings.GUI_BAN_ITEMS_PERMA_ITEM.getString())
.name(Settings.GUI_BAN_ITEMS_PERMA_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_BAN_ITEMS_PERMA_LORE.getStringList(), "is_true", (this.ban.isPermanent() ? "&aTrue" : "&cFalse")))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_BAN_ITEMS_PERMA_LORE.getStringList(), "is_true", (this.ban.isPermanent() ? "&aTrue" : "&cFalse")))
.make(), click -> {
this.ban.setIsPermanent(!this.ban.isPermanent());
@ -90,7 +90,7 @@ public final class GUIBanUser extends AuctionBaseGUI {
setButton(3, 5, QuickItem
.of(Settings.GUI_BAN_ITEMS_REASON_ITEM.getString())
.name(Settings.GUI_BAN_ITEMS_REASON_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_BAN_ITEMS_REASON_LORE.getStringList(), "ban_reason", this.ban.getReason()))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_BAN_ITEMS_REASON_LORE.getStringList(), "ban_reason", this.ban.getReason()))
.make(), click -> new TitleInput(AuctionHouse.getInstance(), click.player, AuctionHouse.getInstance().getLocale().getMessage("titles.ban reason.title").getMessage(), AuctionHouse.getInstance().getLocale().getMessage("titles.ban reason.subtitle").getMessage()) {
@Override
@ -111,7 +111,7 @@ public final class GUIBanUser extends AuctionBaseGUI {
setButton(3, 7, QuickItem
.of(Settings.GUI_BAN_ITEMS_TIME_ITEM.getString())
.name(Settings.GUI_BAN_ITEMS_TIME_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_BAN_ITEMS_TIME_LORE.getStringList(), "ban_time", this.ban.getReadableExpirationDate()))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_BAN_ITEMS_TIME_LORE.getStringList(), "ban_time", this.ban.getReadableExpirationDate()))
.make(), click -> new TitleInput(AuctionHouse.getInstance(), click.player, AuctionHouse.getInstance().getLocale().getMessage("titles.ban length.title").getMessage(), AuctionHouse.getInstance().getLocale().getMessage("titles.ban length.subtitle").getMessage()) {
@Override

View File

@ -30,7 +30,7 @@ public final class GUIBans extends AuctionPagedGUI<Ban> {
return QuickItem
.of(Bukkit.getOfflinePlayer(ban.getId()))
.name(Settings.GUI_BANS_ITEMS_BAN_NAME.getString().replace("%player_name%", ban.locatePlayer().getName()))
.lore(this.player,Replacer.replaceVariables(Settings.GUI_BANS_ITEMS_BAN_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_BANS_ITEMS_BAN_LORE.getStringList(),
"ban_banner", Bukkit.getOfflinePlayer(ban.getBanner()).getName(),
"ban_date", AuctionAPI.getInstance().convertMillisToDate(ban.getTimeCreated()),
"ban_expiration", ban.getReadableExpirationDate(),

View File

@ -29,7 +29,6 @@ import ca.tweetzy.auctionhouse.guis.AuctionUpdatingPagedGUI;
import ca.tweetzy.auctionhouse.guis.core.GUIAuctionHouse;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.gui.events.GuiClickEvent;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.flight.utils.QuickItem;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
@ -81,7 +80,7 @@ public class GUIConfirmBid extends AuctionUpdatingPagedGUI<AuctionedItem> {
setButton(slot, QuickItem
.of(Settings.GUI_CONFIRM_BID_YES_ITEM.getString())
.name(Settings.GUI_CONFIRM_BID_YES_NAME.getString())
.lore(this.player,Settings.GUI_CONFIRM_BID_YES_LORE.getStringList())
.lore(this.player, Settings.GUI_CONFIRM_BID_YES_LORE.getStringList())
.make(), click -> {
// Re-select the item to ensure that it's available
@ -112,7 +111,7 @@ public class GUIConfirmBid extends AuctionUpdatingPagedGUI<AuctionedItem> {
newBiddingAmount = Settings.ROUND_ALL_PRICES.getBoolean() ? Math.round(newBiddingAmount) : newBiddingAmount;
if (Settings.PLAYER_NEEDS_TOTAL_PRICE_TO_BID.getBoolean() && !EconomyManager.hasBalance(click.player, newBiddingAmount)) {
if (Settings.PLAYER_NEEDS_TOTAL_PRICE_TO_BID.getBoolean() && !AuctionHouse.getCurrencyManager().has(click.player, newBiddingAmount)) {
AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(click.player);
return;
}
@ -129,7 +128,7 @@ public class GUIConfirmBid extends AuctionUpdatingPagedGUI<AuctionedItem> {
if (Settings.BIDDING_TAKES_MONEY.getBoolean()) {
final double oldBidAmount = auctionItem.getCurrentPrice();
if (!EconomyManager.hasBalance(click.player, newBiddingAmount)) {
if (!AuctionHouse.getCurrencyManager().has(click.player, newBiddingAmount)) {
AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(click.player);
return;
}
@ -148,15 +147,15 @@ public class GUIConfirmBid extends AuctionUpdatingPagedGUI<AuctionedItem> {
PaymentReason.BID_RETURNED
), null);
else
EconomyManager.deposit(oldBidder, oldBidAmount);
AuctionHouse.getCurrencyManager().deposit(oldBidder, oldBidAmount);
if (oldBidder.isOnline())
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(oldBidAmount)).sendPrefixedMessage(oldBidder.getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(oldBidAmount)).sendPrefixedMessage(oldBidder.getPlayer());
}
EconomyManager.withdrawBalance(click.player, newBiddingAmount);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(click.player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(newBiddingAmount)).sendPrefixedMessage(click.player);
AuctionHouse.getCurrencyManager().withdraw(click.player, newBiddingAmount);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(click.player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(newBiddingAmount)).sendPrefixedMessage(click.player);
}
@ -205,7 +204,7 @@ public class GUIConfirmBid extends AuctionUpdatingPagedGUI<AuctionedItem> {
setButton(slot, QuickItem
.of(Settings.GUI_CONFIRM_BID_NO_ITEM.getString())
.name(Settings.GUI_CONFIRM_BID_NO_NAME.getString())
.lore(this.player,Settings.GUI_CONFIRM_BID_NO_LORE.getStringList())
.lore(this.player, Settings.GUI_CONFIRM_BID_NO_LORE.getStringList())
.make(), click -> {
cancelTask();

View File

@ -28,7 +28,6 @@ import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.auctionhouse.guis.AuctionBaseGUI;
import ca.tweetzy.auctionhouse.guis.core.GUIActiveAuctions;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.flight.utils.QuickItem;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
@ -68,7 +67,7 @@ public class GUIConfirmCancel extends AuctionBaseGUI {
setButton(slot, QuickItem
.of(Settings.GUI_CONFIRM_CANCEL_NO_ITEM.getString())
.name(Settings.GUI_CONFIRM_CANCEL_NO_NAME.getString())
.lore(this.player,Settings.GUI_CONFIRM_CANCEL_NO_LORE.getStringList())
.lore(this.player, Settings.GUI_CONFIRM_CANCEL_NO_LORE.getStringList())
.make(), click -> click.manager.showGUI(click.player, new GUIActiveAuctions(this.auctionPlayer)));
}
@ -76,7 +75,7 @@ public class GUIConfirmCancel extends AuctionBaseGUI {
setButton(slot, QuickItem
.of(Settings.GUI_CONFIRM_CANCEL_YES_ITEM.getString())
.name(Settings.GUI_CONFIRM_CANCEL_YES_NAME.getString())
.lore(this.player,Settings.GUI_CONFIRM_CANCEL_YES_LORE.getStringList())
.lore(this.player, Settings.GUI_CONFIRM_CANCEL_YES_LORE.getStringList())
.make(), click -> {
// Re-select the item to ensure that it's available
@ -101,10 +100,10 @@ public class GUIConfirmCancel extends AuctionBaseGUI {
), null);
else
EconomyManager.deposit(oldBidder, located.getCurrentPrice());
AuctionHouse.getCurrencyManager().deposit(oldBidder, located.getCurrentPrice());
if (oldBidder.isOnline())
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(located.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(located.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
}

View File

@ -34,7 +34,6 @@ import ca.tweetzy.auctionhouse.guis.core.GUIContainerInspect;
import ca.tweetzy.auctionhouse.managers.SoundManager;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.gui.events.GuiClickEvent;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.core.utils.PlayerUtils;
import ca.tweetzy.flight.nbtapi.NBT;
import ca.tweetzy.flight.utils.QuickItem;
@ -155,14 +154,14 @@ public class GUIConfirmPurchase extends AuctionBaseGUI {
final OfflinePlayer requester = Bukkit.getOfflinePlayer(this.auctionItem.getOwner());
// check if the requester even has money
if (!EconomyManager.hasBalance(requester, buyNowPrice)) {
if (!AuctionHouse.getCurrencyManager().has(requester, buyNowPrice)) {
AuctionHouse.getInstance().getLocale().getMessage("general.requesterhasnomoney").sendPrefixedMessage(e.player);
return;
}
// transfer funds
EconomyManager.withdrawBalance(requester, buyNowPrice);
EconomyManager.deposit(e.player, Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? buyNowPrice : buyNowPrice - tax);
AuctionHouse.getCurrencyManager().withdraw(requester, buyNowPrice);
AuctionHouse.getCurrencyManager().deposit(e.player, Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? buyNowPrice : buyNowPrice - tax);
// transfer items
AuctionAPI.getInstance().removeSpecificItemQuantityFromPlayer(this.player, this.auctionItem.getItem(), amountNeeded);
@ -191,9 +190,9 @@ public class GUIConfirmPurchase extends AuctionBaseGUI {
player.closeInventory();
});
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(e.player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getBasePrice())).sendPrefixedMessage(e.player);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(e.player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getBasePrice())).sendPrefixedMessage(e.player);
if (requester.isOnline())
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(requester.getPlayer()))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getBasePrice())).sendPrefixedMessage(requester.getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(requester.getPlayer()))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getBasePrice())).sendPrefixedMessage(requester.getPlayer());
e.gui.close();
return;
@ -204,7 +203,7 @@ public class GUIConfirmPurchase extends AuctionBaseGUI {
// languageNodes.put("pricing.moneyadd", "&a&l+ $%price% &7(%player_balance%)");
// Check economy
if (!EconomyManager.hasBalance(e.player, buyNowPrice + (Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? tax : 0D))) {
if (!AuctionHouse.getCurrencyManager().has(e.player, buyNowPrice + (Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? tax : 0D))) {
AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(e.player);
SoundManager.getInstance().playSound(e.player, Settings.SOUNDS_NOT_ENOUGH_MONEY.getString());
e.gui.close();
@ -263,10 +262,10 @@ public class GUIConfirmPurchase extends AuctionBaseGUI {
PaymentReason.BID_RETURNED
), null);
else
EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());
AuctionHouse.getCurrencyManager().deposit(oldBidder, auctionItem.getCurrentPrice());
if (oldBidder.isOnline())
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(located.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(located.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
}
@ -338,7 +337,7 @@ public class GUIConfirmPurchase extends AuctionBaseGUI {
double totalPrice = overwritePrice ? price : located.getBasePrice();
double tax = Settings.TAX_ENABLED.getBoolean() ? (Settings.TAX_SALES_TAX_BUY_NOW_PERCENTAGE.getDouble() / 100) * totalPrice : 0D;
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(e.player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? totalPrice - tax : totalPrice)).sendPrefixedMessage(e.player);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(e.player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? totalPrice - tax : totalPrice)).sendPrefixedMessage(e.player);
AuctionHouse.getInstance().getLocale().getMessage("general.bought_item").processPlaceholder("amount", qtyOverride).processPlaceholder("item", AuctionAPI.getInstance().getItemName(located.getItem())).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? totalPrice - tax : totalPrice)).sendPrefixedMessage(e.player);
if (Bukkit.getOfflinePlayer(located.getOwner()).isOnline()) {
@ -348,7 +347,7 @@ public class GUIConfirmPurchase extends AuctionBaseGUI {
.processPlaceholder("price", AuctionAPI.getInstance().formatNumber(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? totalPrice : totalPrice - tax))
.processPlaceholder("buyer_name", e.player.getName())
.sendPrefixedMessage(Bukkit.getOfflinePlayer(located.getOwner()).getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(Bukkit.getOfflinePlayer(located.getOwner())))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? totalPrice : totalPrice - tax)).sendPrefixedMessage(Bukkit.getOfflinePlayer(located.getOwner()).getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(Bukkit.getOfflinePlayer(located.getOwner())))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? totalPrice : totalPrice - tax)).sendPrefixedMessage(Bukkit.getOfflinePlayer(located.getOwner()).getPlayer());
}
}
@ -361,7 +360,7 @@ public class GUIConfirmPurchase extends AuctionBaseGUI {
.of(Settings.GUI_CONFIRM_QTY_INFO_ITEM.getString())
.amount(qty)
.name(Settings.GUI_CONFIRM_QTY_INFO_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_CONFIRM_QTY_INFO_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_CONFIRM_QTY_INFO_LORE.getStringList(),
"original_stack_size", maxStackSize,
"original_stack_price", AuctionAPI.getInstance().formatNumber(auctionItem.getBasePrice()),
"price_per_item", AuctionAPI.getInstance().formatNumber(pricePerItem),
@ -372,26 +371,26 @@ public class GUIConfirmPurchase extends AuctionBaseGUI {
}
private ItemStack getIncreaseQtyButtonItem() {
return QuickItem.of(Settings.GUI_CONFIRM_INCREASE_QTY_ITEM.getString()).name(Settings.GUI_CONFIRM_INCREASE_QTY_NAME.getString()).lore(this.player,Settings.GUI_CONFIRM_INCREASE_QTY_LORE.getStringList()).make();
return QuickItem.of(Settings.GUI_CONFIRM_INCREASE_QTY_ITEM.getString()).name(Settings.GUI_CONFIRM_INCREASE_QTY_NAME.getString()).lore(this.player, Settings.GUI_CONFIRM_INCREASE_QTY_LORE.getStringList()).make();
}
private ItemStack getDecreaseQtyButtonItem() {
return QuickItem.of(Settings.GUI_CONFIRM_DECREASE_QTY_ITEM.getString()).name(Settings.GUI_CONFIRM_DECREASE_QTY_NAME.getString()).lore(this.player,Settings.GUI_CONFIRM_DECREASE_QTY_LORE.getStringList()).make();
return QuickItem.of(Settings.GUI_CONFIRM_DECREASE_QTY_ITEM.getString()).name(Settings.GUI_CONFIRM_DECREASE_QTY_NAME.getString()).lore(this.player, Settings.GUI_CONFIRM_DECREASE_QTY_LORE.getStringList()).make();
}
protected ItemStack getConfirmBuyYesItem() {
return QuickItem.of(Settings.GUI_CONFIRM_BUY_YES_ITEM.getString()).name(Settings.GUI_CONFIRM_BUY_YES_NAME.getString()).lore(this.player,Settings.GUI_CONFIRM_BUY_YES_LORE.getStringList()).make();
return QuickItem.of(Settings.GUI_CONFIRM_BUY_YES_ITEM.getString()).name(Settings.GUI_CONFIRM_BUY_YES_NAME.getString()).lore(this.player, Settings.GUI_CONFIRM_BUY_YES_LORE.getStringList()).make();
}
protected ItemStack getConfirmBuyNoItem() {
return QuickItem.of(Settings.GUI_CONFIRM_BUY_NO_ITEM.getString()).name(Settings.GUI_CONFIRM_BUY_NO_NAME.getString()).lore(this.player,Settings.GUI_CONFIRM_BUY_NO_LORE.getStringList()).make();
return QuickItem.of(Settings.GUI_CONFIRM_BUY_NO_ITEM.getString()).name(Settings.GUI_CONFIRM_BUY_NO_NAME.getString()).lore(this.player, Settings.GUI_CONFIRM_BUY_NO_LORE.getStringList()).make();
}
protected ItemStack getConfirmRequestYesItem() {
return QuickItem.of(Settings.GUI_CONFIRM_REQUEST_YES_ITEM.getString()).name(Settings.GUI_CONFIRM_REQUEST_YES_NAME.getString()).lore(this.player,Settings.GUI_CONFIRM_REQUEST_YES_LORE.getStringList()).make();
return QuickItem.of(Settings.GUI_CONFIRM_REQUEST_YES_ITEM.getString()).name(Settings.GUI_CONFIRM_REQUEST_YES_NAME.getString()).lore(this.player, Settings.GUI_CONFIRM_REQUEST_YES_LORE.getStringList()).make();
}
protected ItemStack getConfirmRequestNoItem() {
return QuickItem.of(Settings.GUI_CONFIRM_REQUEST_NO_ITEM.getString()).name(Settings.GUI_CONFIRM_REQUEST_NO_NAME.getString()).lore(this.player,Settings.GUI_CONFIRM_REQUEST_NO_LORE.getStringList()).make();
return QuickItem.of(Settings.GUI_CONFIRM_REQUEST_NO_ITEM.getString()).name(Settings.GUI_CONFIRM_REQUEST_NO_NAME.getString()).lore(this.player, Settings.GUI_CONFIRM_REQUEST_NO_LORE.getStringList()).make();
}
}

View File

@ -94,7 +94,7 @@ public final class GUIListingConfirm extends AuctionBaseGUI {
setButton(slot, QuickItem
.of(Settings.GUI_CONFIRM_LISTING_NO_ITEM.getString())
.name(Settings.GUI_CONFIRM_LISTING_NO_NAME.getString())
.lore(this.player,Settings.GUI_CONFIRM_LISTING_NO_LORE.getStringList())
.lore(this.player, Settings.GUI_CONFIRM_LISTING_NO_LORE.getStringList())
.make(), click -> {
if (resulted.contains(click.player.getUniqueId())) return;
@ -111,7 +111,7 @@ public final class GUIListingConfirm extends AuctionBaseGUI {
setButton(slot, QuickItem
.of(Settings.GUI_CONFIRM_LISTING_YES_ITEM.getString())
.name(Settings.GUI_CONFIRM_LISTING_YES_NAME.getString())
.lore(this.player,Settings.GUI_CONFIRM_LISTING_YES_LORE.getStringList())
.lore(this.player, Settings.GUI_CONFIRM_LISTING_YES_LORE.getStringList())
.make(), click -> {
if (resulted.contains(click.player.getUniqueId())) return;

View File

@ -29,7 +29,6 @@ import ca.tweetzy.auctionhouse.guis.AuctionUpdatingPagedGUI;
import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmCancel;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.gui.events.GuiClickEvent;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.flight.utils.Common;
import ca.tweetzy.flight.utils.QuickItem;
import ca.tweetzy.flight.utils.messages.Titles;
@ -111,10 +110,10 @@ public class GUIActiveAuctions extends AuctionUpdatingPagedGUI<AuctionedItem> {
PaymentReason.BID_RETURNED
), null);
else
EconomyManager.deposit(oldBidder, item.getCurrentPrice());
AuctionHouse.getCurrencyManager().deposit(oldBidder, item.getCurrentPrice());
if (oldBidder.isOnline())
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(item.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(item.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
}
@ -157,7 +156,7 @@ public class GUIActiveAuctions extends AuctionUpdatingPagedGUI<AuctionedItem> {
setButton(5, 1, QuickItem
.of(Settings.GUI_ACTIVE_AUCTIONS_ITEM.getString())
.name(Settings.GUI_ACTIVE_AUCTIONS_NAME.getString())
.lore(this.player,Settings.GUI_ACTIVE_AUCTIONS_LORE.getStringList())
.lore(this.player, Settings.GUI_ACTIVE_AUCTIONS_LORE.getStringList())
.make(), e -> {
if (Settings.ASK_FOR_CANCEL_CONFIRM_ON_ALL_ITEMS.getBoolean()) {

View File

@ -24,7 +24,6 @@ import ca.tweetzy.auctionhouse.helpers.input.TitleInput;
import ca.tweetzy.auctionhouse.hooks.FloodGateHook;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.gui.events.GuiClickEvent;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.core.utils.NumberUtils;
import ca.tweetzy.flight.comp.enums.ServerVersion;
import ca.tweetzy.flight.utils.QuickItem;
@ -198,7 +197,7 @@ public final class GUIAuctionHouse extends AuctionUpdatingPagedGUI<AuctionedItem
return;
}
if (!buyingQuantity) if (!EconomyManager.hasBalance(click.player, auctionItem.getBasePrice())) {
if (!buyingQuantity) if (!AuctionHouse.getCurrencyManager().has(click.player, auctionItem.getBasePrice())) {
AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(click.player);
return;
}
@ -298,7 +297,7 @@ public final class GUIAuctionHouse extends AuctionUpdatingPagedGUI<AuctionedItem
newBiddingAmount = Settings.ROUND_ALL_PRICES.getBoolean() ? Math.round(newBiddingAmount) : newBiddingAmount;
if (Settings.PLAYER_NEEDS_TOTAL_PRICE_TO_BID.getBoolean() && !EconomyManager.hasBalance(click.player, newBiddingAmount)) {
if (Settings.PLAYER_NEEDS_TOTAL_PRICE_TO_BID.getBoolean() && !AuctionHouse.getCurrencyManager().has(click.player, newBiddingAmount)) {
AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(click.player);
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIAuctionHouse(GUIAuctionHouse.this.auctionPlayer));
return true;
@ -321,7 +320,7 @@ public final class GUIAuctionHouse extends AuctionUpdatingPagedGUI<AuctionedItem
if (Settings.BIDDING_TAKES_MONEY.getBoolean()) {
final double oldBidAmount = auctionItem.getCurrentPrice();
if (!EconomyManager.hasBalance(click.player, newBiddingAmount)) {
if (!AuctionHouse.getCurrencyManager().has(click.player, newBiddingAmount)) {
AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(click.player);
return true;
}
@ -333,13 +332,13 @@ public final class GUIAuctionHouse extends AuctionUpdatingPagedGUI<AuctionedItem
if (!auctionItem.getHighestBidder().equals(auctionItem.getOwner())) {
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), oldBidAmount, auctionItem.getItem(), AuctionHouse.getInstance().getLocale().getMessage("general.prefix").getMessage(), PaymentReason.BID_RETURNED), null);
else EconomyManager.deposit(oldBidder, oldBidAmount);
else AuctionHouse.getCurrencyManager().deposit(oldBidder, oldBidAmount);
if (oldBidder.isOnline())
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(oldBidAmount)).sendPrefixedMessage(oldBidder.getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(oldBidAmount)).sendPrefixedMessage(oldBidder.getPlayer());
}
EconomyManager.withdrawBalance(click.player, newBiddingAmount);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(click.player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(newBiddingAmount)).sendPrefixedMessage(click.player);
AuctionHouse.getCurrencyManager().withdraw(click.player, newBiddingAmount);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(click.player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(newBiddingAmount)).sendPrefixedMessage(click.player);
}
@ -432,7 +431,7 @@ public final class GUIAuctionHouse extends AuctionUpdatingPagedGUI<AuctionedItem
setButton(Settings.GUI_AUCTION_HOUSE_ITEMS_YOUR_AUCTIONS_SLOT.getInt(), QuickItem
.of(Settings.GUI_AUCTION_HOUSE_ITEMS_YOUR_AUCTIONS_ITEM.getString())
.name(Settings.GUI_AUCTION_HOUSE_ITEMS_YOUR_AUCTIONS_NAME.getString())
.lore(this.player, Replacer.replaceVariables(Settings.GUI_AUCTION_HOUSE_ITEMS_YOUR_AUCTIONS_LORE.getStringList(), "active_player_auctions", auctionPlayer.getItems(false).size(), "player_balance", Settings.USE_SHORT_NUMBERS_ON_PLAYER_BALANCE.getBoolean() ? AuctionAPI.getInstance().getFriendlyNumber(EconomyManager.getBalance(auctionPlayer.getPlayer())) : AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(auctionPlayer.getPlayer())))).make(), e -> {
.lore(this.player, Replacer.replaceVariables(Settings.GUI_AUCTION_HOUSE_ITEMS_YOUR_AUCTIONS_LORE.getStringList(), "active_player_auctions", auctionPlayer.getItems(false).size(), "player_balance", Settings.USE_SHORT_NUMBERS_ON_PLAYER_BALANCE.getBoolean() ? AuctionAPI.getInstance().getFriendlyNumber(AuctionHouse.getCurrencyManager().getBalance(auctionPlayer.getPlayer())) : AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(auctionPlayer.getPlayer())))).make(), e -> {
cancelTask();
e.manager.showGUI(e.player, new GUIActiveAuctions(this.auctionPlayer));
@ -469,7 +468,7 @@ public final class GUIAuctionHouse extends AuctionUpdatingPagedGUI<AuctionedItem
setButton(Settings.GUI_AUCTION_HOUSE_ITEMS_LIST_ITEM_SLOT.getInt(), QuickItem
.of(Settings.GUI_AUCTION_HOUSE_ITEMS_LIST_ITEM_ITEM.getString())
.name(Settings.GUI_AUCTION_HOUSE_ITEMS_LIST_ITEM_NAME.getString())
.lore(this.player,Settings.GUI_AUCTION_HOUSE_ITEMS_LIST_ITEM_LORE.getStringList())
.lore(this.player, Settings.GUI_AUCTION_HOUSE_ITEMS_LIST_ITEM_LORE.getStringList())
.make(), e -> {
if (AuctionHouse.getInstance().getBanManager().isStillBanned(e.player, BanType.EVERYTHING, BanType.SELL)) return;
@ -516,7 +515,7 @@ public final class GUIAuctionHouse extends AuctionUpdatingPagedGUI<AuctionedItem
setItem(Settings.GUI_AUCTION_HOUSE_ITEMS_HOW_TO_SELL_SLOT.getInt(), QuickItem
.of(Settings.GUI_AUCTION_HOUSE_ITEMS_HOW_TO_SELL_ITEM.getString())
.name(Settings.GUI_AUCTION_HOUSE_ITEMS_HOW_TO_SELL_NAME.getString())
.lore(this.player,Settings.GUI_AUCTION_HOUSE_ITEMS_HOW_TO_SELL_LORE.getStringList())
.lore(this.player, Settings.GUI_AUCTION_HOUSE_ITEMS_HOW_TO_SELL_LORE.getStringList())
.make());
}
}
@ -524,7 +523,7 @@ public final class GUIAuctionHouse extends AuctionUpdatingPagedGUI<AuctionedItem
if (Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_ENABLED.getBoolean()) {
setItem(Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_SLOT.getInt(), QuickItem
.of(Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_ITEM.getString())
.name(Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_NAME.getString()).lore(this.player,Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_LORE.getStringList())
.name(Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_NAME.getString()).lore(this.player, Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_LORE.getStringList())
.make());
}
@ -585,11 +584,11 @@ public final class GUIAuctionHouse extends AuctionUpdatingPagedGUI<AuctionedItem
QuickItem
.of(AuctionAPI.getInstance().getPlayerHead(this.auctionPlayer.getPlayer().getName()))
.name(Replacer.replaceVariables(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_MENU_NAME.getString(), "filter_category", auctionPlayer.getSelectedFilter().getTranslatedType(), "filter_auction_type", auctionPlayer.getSelectedSaleType().getTranslatedType(), "filter_sort_order", auctionPlayer.getAuctionSortType().getTranslatedType()))
.lore(this.player,Replacer.replaceVariables(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_MENU_LORE.getStringList(), "filter_category", auctionPlayer.getSelectedFilter().getTranslatedType(), "filter_auction_type", auctionPlayer.getSelectedSaleType().getTranslatedType(), "filter_sort_order", auctionPlayer.getAuctionSortType().getTranslatedType()))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_MENU_LORE.getStringList(), "filter_category", auctionPlayer.getSelectedFilter().getTranslatedType(), "filter_auction_type", auctionPlayer.getSelectedSaleType().getTranslatedType(), "filter_sort_order", auctionPlayer.getAuctionSortType().getTranslatedType()))
.make() : QuickItem
.of(materialToBeUsed)
.name(Replacer.replaceVariables(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_MENU_NAME.getString(), "filter_category", auctionPlayer.getSelectedFilter().getTranslatedType(), "filter_auction_type", auctionPlayer.getSelectedSaleType().getTranslatedType(), "filter_sort_order", auctionPlayer.getAuctionSortType().getTranslatedType()))
.lore(this.player,Replacer.replaceVariables(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_MENU_LORE.getStringList(), "filter_category", auctionPlayer.getSelectedFilter().getTranslatedType(), "filter_auction_type", auctionPlayer.getSelectedSaleType().getTranslatedType(), "filter_sort_order", auctionPlayer.getAuctionSortType().getTranslatedType())).make();
.lore(this.player, Replacer.replaceVariables(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_MENU_LORE.getStringList(), "filter_category", auctionPlayer.getSelectedFilter().getTranslatedType(), "filter_auction_type", auctionPlayer.getSelectedSaleType().getTranslatedType(), "filter_sort_order", auctionPlayer.getAuctionSortType().getTranslatedType())).make();
if (Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_MENU_ENABLED.getBoolean()) {
setButton(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_MENU_SLOT.getInt(), item, e -> {
@ -629,7 +628,7 @@ public final class GUIAuctionHouse extends AuctionUpdatingPagedGUI<AuctionedItem
setButton(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_SLOT.getInt(), QuickItem
.of(this.auctionPlayer.getSelectedFilter().getFilterIcon())
.name(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_LORE.getStringList(),
"filter_category", auctionPlayer.getSelectedFilter().getTranslatedType(),
"filter_auction_type", auctionPlayer.getSelectedSaleType().getTranslatedType(),
"filter_sort_order", auctionPlayer.getAuctionSortType().getTranslatedType()))

View File

@ -95,7 +95,7 @@ public final class GUIBundleCreation extends AuctionBaseGUI {
setButton(getRows() - 1, 4, QuickItem
.of(Settings.GUI_CREATE_BUNDLE_CONFIRM_ITEM.getString())
.name(Settings.GUI_CREATE_BUNDLE_CONFIRM_NAME.getString())
.lore(this.player,Settings.GUI_CREATE_BUNDLE_CONFIRM_LORE.getStringList())
.lore(this.player, Settings.GUI_CREATE_BUNDLE_CONFIRM_LORE.getStringList())
.make(), ClickType.LEFT, e -> {

View File

@ -123,14 +123,14 @@ public class GUIExpiredItems extends AuctionPagedGUI<AuctionedItem> {
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) {
setButton(5, 2, QuickItem
.of(Settings.GUI_EXPIRED_AUCTIONS_PAYMENTS_ITEM.getString())
.name(Settings.GUI_EXPIRED_AUCTIONS_PAYMENTS_NAME.getString()).lore(this.player,Settings.GUI_EXPIRED_AUCTIONS_PAYMENTS_LORE.getStringList())
.name(Settings.GUI_EXPIRED_AUCTIONS_PAYMENTS_NAME.getString()).lore(this.player, Settings.GUI_EXPIRED_AUCTIONS_PAYMENTS_LORE.getStringList())
.make(), e -> e.manager.showGUI(e.player, new GUIPaymentCollection(this, this.auctionPlayer)));
}
setButton(5, 1, QuickItem
.of(Settings.GUI_EXPIRED_AUCTIONS_ITEM.getString())
.name(Settings.GUI_EXPIRED_AUCTIONS_NAME.getString())
.lore(this.player,Settings.GUI_EXPIRED_AUCTIONS_LORE.getStringList())
.lore(this.player, Settings.GUI_EXPIRED_AUCTIONS_LORE.getStringList())
.make(), e -> {
if (AuctionHouse.getInstance().getBanManager().isStillBanned(e.player, BanType.EVERYTHING, BanType.ITEM_COLLECTION)) return;

View File

@ -67,7 +67,7 @@ public class GUIPaymentCollection extends AuctionPagedGUI<AuctionPayment> {
return QuickItem
.of(Settings.GUI_PAYMENT_COLLECTION_PAYMENT_ITEM.getString())
.name(Replacer.replaceVariables(Settings.GUI_PAYMENT_COLLECTION_PAYMENT_NAME.getString(), "payment_amount", AuctionAPI.getInstance().formatNumber(payment.getAmount())))
.lore(this.player,Replacer.replaceVariables(Settings.GUI_PAYMENT_COLLECTION_PAYMENT_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_PAYMENT_COLLECTION_PAYMENT_LORE.getStringList(),
"item_name", AuctionAPI.getInstance().getItemName(payment.getItem()),
"from_name", payment.getFromName(),
"payment_reason", payment.getReason().getTranslation()
@ -98,7 +98,7 @@ public class GUIPaymentCollection extends AuctionPagedGUI<AuctionPayment> {
setButton(5, 1, QuickItem.of(Settings.GUI_PAYMENT_COLLECTION_ITEM.getString())
.name(Settings.GUI_PAYMENT_COLLECTION_NAME.getString())
.lore(this.player,Settings.GUI_PAYMENT_COLLECTION_LORE.getStringList())
.lore(this.player, Settings.GUI_PAYMENT_COLLECTION_LORE.getStringList())
.make(), e -> {
if (this.lastClicked == null) {

View File

@ -30,7 +30,6 @@ import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmBid;
import ca.tweetzy.auctionhouse.guis.core.GUIAuctionHouse;
import ca.tweetzy.auctionhouse.helpers.input.TitleInput;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.core.utils.NumberUtils;
import ca.tweetzy.flight.utils.QuickItem;
import org.bukkit.Bukkit;
@ -66,9 +65,9 @@ public class GUIBid extends AuctionBaseGUI {
setButton(1, 2, QuickItem
.of(Settings.GUI_BIDDING_ITEMS_DEFAULT_ITEM.getString())
.name(Settings.GUI_BIDDING_ITEMS_DEFAULT_NAME.getString())
.lore(this.player,Settings.GUI_BIDDING_ITEMS_DEFAULT_LORE.getStringList()).make(), e -> {
.lore(this.player, Settings.GUI_BIDDING_ITEMS_DEFAULT_LORE.getStringList()).make(), e -> {
if (Settings.PLAYER_NEEDS_TOTAL_PRICE_TO_BID.getBoolean() && !EconomyManager.hasBalance(e.player, auctionItem.getCurrentPrice() + auctionItem.getBidIncrementPrice())) {
if (Settings.PLAYER_NEEDS_TOTAL_PRICE_TO_BID.getBoolean() && !AuctionHouse.getCurrencyManager().has(e.player, auctionItem.getCurrentPrice() + auctionItem.getBidIncrementPrice())) {
AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(e.player);
return;
}
@ -83,7 +82,7 @@ public class GUIBid extends AuctionBaseGUI {
setButton(1, 6, QuickItem
.of(Settings.GUI_BIDDING_ITEMS_CUSTOM_ITEM.getString())
.name(Settings.GUI_BIDDING_ITEMS_CUSTOM_NAME.getString())
.lore(this.player,Settings.GUI_BIDDING_ITEMS_CUSTOM_LORE.getStringList())
.lore(this.player, Settings.GUI_BIDDING_ITEMS_CUSTOM_LORE.getStringList())
.make(), e -> {
e.gui.exit();
@ -145,7 +144,7 @@ public class GUIBid extends AuctionBaseGUI {
newBiddingAmount = Settings.ROUND_ALL_PRICES.getBoolean() ? Math.round(newBiddingAmount) : newBiddingAmount;
if (Settings.PLAYER_NEEDS_TOTAL_PRICE_TO_BID.getBoolean() && !EconomyManager.hasBalance(e.player, newBiddingAmount)) {
if (Settings.PLAYER_NEEDS_TOTAL_PRICE_TO_BID.getBoolean() && !AuctionHouse.getCurrencyManager().has(e.player, newBiddingAmount)) {
AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(e.player);
return true;
}
@ -167,7 +166,7 @@ public class GUIBid extends AuctionBaseGUI {
if (Settings.BIDDING_TAKES_MONEY.getBoolean()) {
final double oldBidAmount = auctionItem.getCurrentPrice();
if (!EconomyManager.hasBalance(e.player, newBiddingAmount)) {
if (!AuctionHouse.getCurrencyManager().has(e.player, newBiddingAmount)) {
AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(e.player);
return true;
}
@ -186,13 +185,13 @@ public class GUIBid extends AuctionBaseGUI {
PaymentReason.BID_RETURNED
), null);
else
EconomyManager.deposit(oldBidder, oldBidAmount);
AuctionHouse.getCurrencyManager().deposit(oldBidder, oldBidAmount);
if (oldBidder.isOnline())
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(oldBidAmount)).sendPrefixedMessage(oldBidder.getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(oldBidAmount)).sendPrefixedMessage(oldBidder.getPlayer());
}
EconomyManager.withdrawBalance(e.player, newBiddingAmount);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(e.player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(newBiddingAmount)).sendPrefixedMessage(e.player);
AuctionHouse.getCurrencyManager().withdraw(e.player, newBiddingAmount);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(e.player))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(newBiddingAmount)).sendPrefixedMessage(e.player);
}

View File

@ -54,21 +54,21 @@ public class GUIFilterSelection extends AuctionBaseGUI {
protected void draw() {
if (AuctionItemCategory.ALL.isEnabled())
setButton(1, 3, QuickItem.of(Settings.GUI_FILTER_ITEMS_ALL_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_ALL_NAME.getString()).lore(this.player,Settings.GUI_FILTER_ITEMS_ALL_LORE.getStringList()).make(), e -> {
setButton(1, 3, QuickItem.of(Settings.GUI_FILTER_ITEMS_ALL_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_ALL_NAME.getString()).lore(this.player, Settings.GUI_FILTER_ITEMS_ALL_LORE.getStringList()).make(), e -> {
this.auctionPlayer.setSelectedFilter(AuctionItemCategory.ALL);
updatePlayerFilter(this.auctionPlayer);
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
});
if (AuctionItemCategory.SELF.isEnabled())
setButton(1, 4, QuickItem.of(this.player).name(Settings.GUI_FILTER_ITEMS_OWN_NAME.getString()).lore(this.player,Settings.GUI_FILTER_ITEMS_OWN_LORE.getStringList()).make(), e -> {
setButton(1, 4, QuickItem.of(this.player).name(Settings.GUI_FILTER_ITEMS_OWN_NAME.getString()).lore(this.player, Settings.GUI_FILTER_ITEMS_OWN_LORE.getStringList()).make(), e -> {
this.auctionPlayer.setSelectedFilter(AuctionItemCategory.SELF);
updatePlayerFilter(this.auctionPlayer);
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
});
if (AuctionItemCategory.SEARCH.isEnabled())
setButton(1, 5, QuickItem.of(Settings.GUI_FILTER_ITEMS_SEARCH_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_SEARCH_NAME.getString()).lore(this.player,Replacer.replaceVariables(Settings.GUI_FILTER_ITEMS_SEARCH_LORE.getStringList(), "filter_search_phrase", this.auctionPlayer.getCurrentSearchPhrase())).make(), e -> {
setButton(1, 5, QuickItem.of(Settings.GUI_FILTER_ITEMS_SEARCH_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_SEARCH_NAME.getString()).lore(this.player, Replacer.replaceVariables(Settings.GUI_FILTER_ITEMS_SEARCH_LORE.getStringList(), "filter_search_phrase", this.auctionPlayer.getCurrentSearchPhrase())).make(), e -> {
if (!e.player.hasPermission("auctionhouse.cmd.search")) {
AuctionHouse.getInstance().getLocale().getMessage("commands.no_permission").sendPrefixedMessage(e.player);
return;
@ -86,56 +86,56 @@ public class GUIFilterSelection extends AuctionBaseGUI {
});
if (AuctionItemCategory.MISC.isEnabled())
setButton(2, 1, QuickItem.of(Settings.GUI_FILTER_ITEMS_MISC_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_MISC_NAME.getString()).lore(this.player,Settings.GUI_FILTER_ITEMS_MISC_LORE.getStringList()).make(), e -> {
setButton(2, 1, QuickItem.of(Settings.GUI_FILTER_ITEMS_MISC_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_MISC_NAME.getString()).lore(this.player, Settings.GUI_FILTER_ITEMS_MISC_LORE.getStringList()).make(), e -> {
this.auctionPlayer.setSelectedFilter(AuctionItemCategory.MISC);
updatePlayerFilter(this.auctionPlayer);
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
});
if (AuctionItemCategory.ENCHANTS.isEnabled())
setButton(2, 2, QuickItem.of(Settings.GUI_FILTER_ITEMS_ENCHANTS_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_ENCHANTS_NAME.getString()).lore(this.player,Settings.GUI_FILTER_ITEMS_ENCHANTS_LORE.getStringList()).make(), e -> {
setButton(2, 2, QuickItem.of(Settings.GUI_FILTER_ITEMS_ENCHANTS_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_ENCHANTS_NAME.getString()).lore(this.player, Settings.GUI_FILTER_ITEMS_ENCHANTS_LORE.getStringList()).make(), e -> {
this.auctionPlayer.setSelectedFilter(AuctionItemCategory.ENCHANTS);
updatePlayerFilter(this.auctionPlayer);
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
});
if (AuctionItemCategory.ARMOR.isEnabled())
setButton(2, 3, QuickItem.of(Settings.GUI_FILTER_ITEMS_ARMOR_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_ARMOR_NAME.getString()).lore(this.player,Settings.GUI_FILTER_ITEMS_ARMOR_LORE.getStringList()).make(), e -> {
setButton(2, 3, QuickItem.of(Settings.GUI_FILTER_ITEMS_ARMOR_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_ARMOR_NAME.getString()).lore(this.player, Settings.GUI_FILTER_ITEMS_ARMOR_LORE.getStringList()).make(), e -> {
this.auctionPlayer.setSelectedFilter(AuctionItemCategory.ARMOR);
updatePlayerFilter(this.auctionPlayer);
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
});
if (AuctionItemCategory.WEAPONS.isEnabled())
setButton(2, 4, QuickItem.of(Settings.GUI_FILTER_ITEMS_WEAPONS_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_WEAPONS_NAME.getString()).lore(this.player,Settings.GUI_FILTER_ITEMS_WEAPONS_LORE.getStringList()).make(), e -> {
setButton(2, 4, QuickItem.of(Settings.GUI_FILTER_ITEMS_WEAPONS_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_WEAPONS_NAME.getString()).lore(this.player, Settings.GUI_FILTER_ITEMS_WEAPONS_LORE.getStringList()).make(), e -> {
this.auctionPlayer.setSelectedFilter(AuctionItemCategory.WEAPONS);
updatePlayerFilter(this.auctionPlayer);
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
});
if (AuctionItemCategory.TOOLS.isEnabled())
setButton(2, 5, QuickItem.of(Settings.GUI_FILTER_ITEMS_TOOLS_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_TOOLS_NAME.getString()).lore(this.player,Settings.GUI_FILTER_ITEMS_TOOLS_LORE.getStringList()).make(), e -> {
setButton(2, 5, QuickItem.of(Settings.GUI_FILTER_ITEMS_TOOLS_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_TOOLS_NAME.getString()).lore(this.player, Settings.GUI_FILTER_ITEMS_TOOLS_LORE.getStringList()).make(), e -> {
this.auctionPlayer.setSelectedFilter(AuctionItemCategory.TOOLS);
updatePlayerFilter(this.auctionPlayer);
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
});
if (AuctionItemCategory.SPAWNERS.isEnabled())
setButton(2, 6, QuickItem.of(Settings.GUI_FILTER_ITEMS_SPAWNERS_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_SPAWNERS_NAME.getString()).lore(this.player,Settings.GUI_FILTER_ITEMS_SPAWNERS_LORE.getStringList()).make(), e -> {
setButton(2, 6, QuickItem.of(Settings.GUI_FILTER_ITEMS_SPAWNERS_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_SPAWNERS_NAME.getString()).lore(this.player, Settings.GUI_FILTER_ITEMS_SPAWNERS_LORE.getStringList()).make(), e -> {
this.auctionPlayer.setSelectedFilter(AuctionItemCategory.SPAWNERS);
updatePlayerFilter(this.auctionPlayer);
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
});
if (AuctionItemCategory.BLOCKS.isEnabled())
setButton(2, 7, QuickItem.of(Settings.GUI_FILTER_ITEMS_BLOCKS_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_BLOCKS_NAME.getString()).lore(this.player,Settings.GUI_FILTER_ITEMS_BLOCKS_LORE.getStringList()).make(), e -> {
setButton(2, 7, QuickItem.of(Settings.GUI_FILTER_ITEMS_BLOCKS_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_BLOCKS_NAME.getString()).lore(this.player, Settings.GUI_FILTER_ITEMS_BLOCKS_LORE.getStringList()).make(), e -> {
this.auctionPlayer.setSelectedFilter(AuctionItemCategory.BLOCKS);
updatePlayerFilter(this.auctionPlayer);
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
});
if (AuctionItemCategory.POTIONS.isEnabled())
setButton(3, 4, QuickItem.of(Settings.GUI_FILTER_ITEMS_POTIONS_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_POTIONS_NAME.getString()).lore(this.player,Settings.GUI_FILTER_ITEMS_POTIONS_LORE.getStringList()).make(), e -> {
setButton(3, 4, QuickItem.of(Settings.GUI_FILTER_ITEMS_POTIONS_ITEM.getString()).name(Settings.GUI_FILTER_ITEMS_POTIONS_NAME.getString()).lore(this.player, Settings.GUI_FILTER_ITEMS_POTIONS_LORE.getStringList()).make(), e -> {
this.auctionPlayer.setSelectedFilter(AuctionItemCategory.POTIONS);
updatePlayerFilter(this.auctionPlayer);
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));

View File

@ -42,41 +42,41 @@ public class GUIFilterWhitelist extends AuctionBaseGUI {
protected void draw() {
applyBackExit();
setButton(1, 1, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_BLOCKS_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_BLOCKS_NAME.getString()).lore(this.player,Settings.GUI_FILTER_WHITELIST_ITEMS_BLOCKS_LORE.getStringList()).make(), e -> {
setButton(1, 1, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_BLOCKS_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_BLOCKS_NAME.getString()).lore(this.player, Settings.GUI_FILTER_WHITELIST_ITEMS_BLOCKS_LORE.getStringList()).make(), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.BLOCKS));
});
setButton(1, 3, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_FOOD_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_FOOD_NAME.getString()).lore(this.player,Settings.GUI_FILTER_WHITELIST_ITEMS_FOOD_LORE.getStringList()).make(), e -> {
setButton(1, 3, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_FOOD_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_FOOD_NAME.getString()).lore(this.player, Settings.GUI_FILTER_WHITELIST_ITEMS_FOOD_LORE.getStringList()).make(), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.FOOD));
});
setButton(1, 5, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_ARMOR_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_ARMOR_NAME.getString()).lore(this.player,Settings.GUI_FILTER_WHITELIST_ITEMS_ARMOR_LORE.getStringList()).make(), e -> {
setButton(1, 5, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_ARMOR_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_ARMOR_NAME.getString()).lore(this.player, Settings.GUI_FILTER_WHITELIST_ITEMS_ARMOR_LORE.getStringList()).make(), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.ARMOR));
});
setButton(1, 7, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_TOOLS_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_TOOLS_NAME.getString()).lore(this.player,Settings.GUI_FILTER_WHITELIST_ITEMS_TOOLS_LORE.getStringList()).make(), e -> {
setButton(1, 7, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_TOOLS_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_TOOLS_NAME.getString()).lore(this.player, Settings.GUI_FILTER_WHITELIST_ITEMS_TOOLS_LORE.getStringList()).make(), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.TOOLS));
});
// 2ND ROW STARTS
setButton(2, 1, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_SPAWNERS_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_SPAWNERS_NAME.getString()).lore(this.player,Settings.GUI_FILTER_WHITELIST_ITEMS_SPAWNERS_LORE.getStringList()).make(), e -> {
setButton(2, 1, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_SPAWNERS_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_SPAWNERS_NAME.getString()).lore(this.player, Settings.GUI_FILTER_WHITELIST_ITEMS_SPAWNERS_LORE.getStringList()).make(), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.SPAWNERS));
});
setButton(2, 3, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_ENCHANTS_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_ENCHANTS_NAME.getString()).lore(this.player,Settings.GUI_FILTER_WHITELIST_ITEMS_ENCHANTS_LORE.getStringList()).make(), e -> {
setButton(2, 3, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_ENCHANTS_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_ENCHANTS_NAME.getString()).lore(this.player, Settings.GUI_FILTER_WHITELIST_ITEMS_ENCHANTS_LORE.getStringList()).make(), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.ENCHANTS));
});
setButton(2, 5, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_WEAPONS_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_WEAPONS_NAME.getString()).lore(this.player,Settings.GUI_FILTER_WHITELIST_ITEMS_WEAPONS_LORE.getStringList()).make(), e -> {
setButton(2, 5, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_WEAPONS_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_WEAPONS_NAME.getString()).lore(this.player, Settings.GUI_FILTER_WHITELIST_ITEMS_WEAPONS_LORE.getStringList()).make(), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.WEAPONS));
});
setButton(2, 7, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_MISC_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_MISC_NAME.getString()).lore(this.player,Settings.GUI_FILTER_WHITELIST_ITEMS_MISC_LORE.getStringList()).make(), e -> {
setButton(2, 7, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_MISC_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_MISC_NAME.getString()).lore(this.player, Settings.GUI_FILTER_WHITELIST_ITEMS_MISC_LORE.getStringList()).make(), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.MISC));
});
setButton(3, 1, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_POTIONS_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_POTIONS_NAME.getString()).lore(this.player,Settings.GUI_FILTER_WHITELIST_ITEMS_POTIONS_LORE.getStringList()).make(), e -> {
setButton(3, 1, QuickItem.of(Settings.GUI_FILTER_WHITELIST_ITEMS_POTIONS_ITEM.getString()).name(Settings.GUI_FILTER_WHITELIST_ITEMS_POTIONS_NAME.getString()).lore(this.player, Settings.GUI_FILTER_WHITELIST_ITEMS_POTIONS_LORE.getStringList()).make(), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.POTIONS));
});

View File

@ -30,7 +30,7 @@ public final class GUIPlayerSelector extends AuctionPagedGUI<OfflinePlayer> {
return QuickItem
.of(player)
.name(Settings.GUI_PLAYER_SELECTOR_ITEMS_PLAYER_NAME.getString().replace("%player_name%", name))
.lore(this.player,Settings.GUI_PLAYER_SELECTOR_ITEMS_PLAYER_LORE.getStringList())
.lore(this.player, Settings.GUI_PLAYER_SELECTOR_ITEMS_PLAYER_LORE.getStringList())
.make();
}

View File

@ -60,7 +60,7 @@ public final class GUIRequestItem extends AuctionBaseGUI {
setButton(3, 2, QuickItem
.of(Settings.GUI_REQUEST_ITEMS_AMT_ITEM.getString())
.name(Settings.GUI_REQUEST_ITEMS_AMT_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_REQUEST_ITEMS_AMT_LORE.getStringList(), "request_amount", amount))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_REQUEST_ITEMS_AMT_LORE.getStringList(), "request_amount", amount))
.make(), click -> {
click.gui.exit();
@ -106,7 +106,7 @@ public final class GUIRequestItem extends AuctionBaseGUI {
setButton(3, 6, QuickItem
.of(Settings.GUI_REQUEST_ITEMS_PRICE_ITEM.getString())
.name(Settings.GUI_REQUEST_ITEMS_PRICE_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_REQUEST_ITEMS_PRICE_LORE.getStringList(), "request_price", AuctionAPI.getInstance().formatNumber(price)))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_REQUEST_ITEMS_PRICE_LORE.getStringList(), "request_price", AuctionAPI.getInstance().formatNumber(price)))
.make(), click -> {
click.gui.exit();
@ -154,7 +154,7 @@ public final class GUIRequestItem extends AuctionBaseGUI {
setButton(getRows() - 1, 4, QuickItem
.of(Settings.GUI_REQUEST_ITEMS_REQUEST_ITEM.getString())
.name(Settings.GUI_REQUEST_ITEMS_REQUEST_NAME.getString())
.lore(this.player,Settings.GUI_REQUEST_ITEMS_REQUEST_LORE.getStringList())
.lore(this.player, Settings.GUI_REQUEST_ITEMS_REQUEST_LORE.getStringList())
.make(), click -> {
// Check for block items

View File

@ -100,7 +100,7 @@ public final class GUISellAuction extends AuctionBaseGUI {
setButton(3, 1, QuickItem
.of(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_ITEM.getString())
.name(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_LORE.getStringList(),
"remaining_days", times[0],
"remaining_hours", times[1],
"remaining_minutes", times[2],
@ -152,7 +152,7 @@ public final class GUISellAuction extends AuctionBaseGUI {
setButton(3, 4, QuickItem
.of(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_PRICE_ITEM.getString())
.name(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_PRICE_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_PRICE_LORE.getStringList(), "listing_bin_price", AuctionAPI.getInstance().formatNumber(binPrice)))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_PRICE_LORE.getStringList(), "listing_bin_price", AuctionAPI.getInstance().formatNumber(binPrice)))
.make(), click -> {
click.gui.exit();
@ -201,7 +201,7 @@ public final class GUISellAuction extends AuctionBaseGUI {
setButton(3, 3, QuickItem
.of(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_STARTING_PRICE_ITEM.getString())
.name(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_STARTING_PRICE_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_STARTING_PRICE_LORE.getStringList(), "listing_start_price", AuctionAPI.getInstance().formatNumber(startingBid)))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_STARTING_PRICE_LORE.getStringList(), "listing_start_price", AuctionAPI.getInstance().formatNumber(startingBid)))
.make(), click -> {
click.gui.exit();
@ -259,7 +259,7 @@ public final class GUISellAuction extends AuctionBaseGUI {
setButton(3, 5, QuickItem
.of(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_INCREMENT_PRICE_ITEM.getString())
.name(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_INCREMENT_PRICE_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_INCREMENT_PRICE_LORE.getStringList(), "listing_increment_price", AuctionAPI.getInstance().formatNumber(bidIncrement)))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_INCREMENT_PRICE_LORE.getStringList(), "listing_increment_price", AuctionAPI.getInstance().formatNumber(bidIncrement)))
.make(), click -> {
click.gui.exit();
@ -311,7 +311,7 @@ public final class GUISellAuction extends AuctionBaseGUI {
setButton(getRows() - 1, 4, QuickItem
.of(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_CONTINUE_ITEM.getString())
.name(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_CONTINUE_NAME.getString())
.lore(this.player,Settings.GUI_SELL_AUCTION_ITEM_ITEMS_CONTINUE_LORE.getStringList())
.lore(this.player, Settings.GUI_SELL_AUCTION_ITEM_ITEMS_CONTINUE_LORE.getStringList())
.make(), click -> {
if (!AuctionAPI.getInstance().meetsListingRequirements(click.player, this.auctionPlayer.getItemBeingListed())) return;
@ -341,7 +341,7 @@ public final class GUISellAuction extends AuctionBaseGUI {
setButton(3, 7, QuickItem
.of(this.allowBuyNow ? Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_ENABLED_ITEM.getString() : Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_DISABLED_ITEM.getString())
.name(this.allowBuyNow ? Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_ENABLED_NAME.getString() : Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_DISABLED_NAME.getString())
.lore(this.player,this.allowBuyNow ? Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_ENABLED_LORE.getStringList() : Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_DISABLED_LORE.getStringList())
.lore(this.player, this.allowBuyNow ? Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_ENABLED_LORE.getStringList() : Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_DISABLED_LORE.getStringList())
.make(), e -> {
this.allowBuyNow = !allowBuyNow;

View File

@ -95,7 +95,7 @@ public final class GUISellBin extends AuctionBaseGUI {
setButton(3, 1, QuickItem
.of(Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_ITEM.getString())
.name(Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_LORE.getStringList(),
"remaining_days", times[0],
"remaining_hours", times[1],
"remaining_minutes", times[2],
@ -134,7 +134,7 @@ public final class GUISellBin extends AuctionBaseGUI {
setButton(3, 4, QuickItem
.of(Settings.GUI_SELL_BIN_ITEM_ITEMS_PRICE_ITEM.getString())
.name(Settings.GUI_SELL_BIN_ITEM_ITEMS_PRICE_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_SELL_BIN_ITEM_ITEMS_PRICE_LORE.getStringList(), "listing_bin_price", AuctionAPI.getInstance().formatNumber(listingPrice)))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_SELL_BIN_ITEM_ITEMS_PRICE_LORE.getStringList(), "listing_bin_price", AuctionAPI.getInstance().formatNumber(listingPrice)))
.make(), click -> {
click.gui.exit();
@ -177,7 +177,7 @@ public final class GUISellBin extends AuctionBaseGUI {
setButton(getRows() - 1, 4, QuickItem
.of(Settings.GUI_SELL_BIN_ITEM_ITEMS_CONTINUE_ITEM.getString())
.name(Settings.GUI_SELL_BIN_ITEM_ITEMS_CONTINUE_NAME.getString())
.lore(this.player,Settings.GUI_SELL_BIN_ITEM_ITEMS_CONTINUE_LORE.getStringList())
.lore(this.player, Settings.GUI_SELL_BIN_ITEM_ITEMS_CONTINUE_LORE.getStringList())
.make(), click -> {
if (!AuctionAPI.getInstance().meetsListingRequirements(click.player, this.auctionPlayer.getItemBeingListed())) return;
@ -223,7 +223,7 @@ public final class GUISellBin extends AuctionBaseGUI {
setButton(3, 7, QuickItem
.of(this.allowPartialBuy ? Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_ENABLED_ITEM.getString() : Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_DISABLED_ITEM.getString())
.name(this.allowPartialBuy ? Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_ENABLED_NAME.getString() : Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_DISABLED_NAME.getString())
.lore(this.player,this.allowPartialBuy ? Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_ENABLED_LORE.getStringList() : Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_DISABLED_LORE.getStringList())
.lore(this.player, this.allowPartialBuy ? Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_ENABLED_LORE.getStringList() : Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_DISABLED_LORE.getStringList())
.make(), e -> {
this.allowPartialBuy = !allowPartialBuy;

View File

@ -57,7 +57,7 @@ public final class GUISellListingType extends AuctionBaseGUI {
setButton(getRows() - 1, 0, QuickItem
.of(Settings.GUI_SELL_LISTING_TYPE_ITEMS_RETURN_ITEM.getString())
.name(Settings.GUI_SELL_LISTING_TYPE_ITEMS_RETURN_NAME.getString())
.lore(this.player,Settings.GUI_SELL_LISTING_TYPE_ITEMS_RETURN_LORE.getStringList())
.lore(this.player, Settings.GUI_SELL_LISTING_TYPE_ITEMS_RETURN_LORE.getStringList())
.make(), click -> click.manager.showGUI(click.player, new GUIAuctionHouse(this.auctionPlayer)));
}
@ -65,7 +65,7 @@ public final class GUISellListingType extends AuctionBaseGUI {
setButton(1, col, QuickItem
.of(Settings.GUI_SELL_LISTING_TYPE_ITEMS_AUCTION_ITEM.getString())
.name(Settings.GUI_SELL_LISTING_TYPE_ITEMS_AUCTION_NAME.getString())
.lore(this.player,Settings.GUI_SELL_LISTING_TYPE_ITEMS_AUCTION_LORE.getStringList())
.lore(this.player, Settings.GUI_SELL_LISTING_TYPE_ITEMS_AUCTION_LORE.getStringList())
.make(), click -> {
if (this.listingType != null)
@ -77,7 +77,7 @@ public final class GUISellListingType extends AuctionBaseGUI {
setButton(1, col, QuickItem
.of(Settings.GUI_SELL_LISTING_TYPE_ITEMS_BIN_ITEM.getString())
.name(Settings.GUI_SELL_LISTING_TYPE_ITEMS_BIN_NAME.getString())
.lore(this.player,Settings.GUI_SELL_LISTING_TYPE_ITEMS_BIN_LORE.getStringList())
.lore(this.player, Settings.GUI_SELL_LISTING_TYPE_ITEMS_BIN_LORE.getStringList())
.make(), click -> {
if (this.listingType != null)

View File

@ -95,7 +95,7 @@ public final class GUISellPlaceItem extends AuctionBaseGUI {
setButton(getRows() - 1, 4, QuickItem
.of(Settings.GUI_SELL_PLACE_ITEM_ITEMS_CONTINUE_ITEM.getString())
.name(Settings.GUI_SELL_PLACE_ITEM_ITEMS_CONTINUE_NAME.getString())
.lore(this.player,Settings.GUI_SELL_PLACE_ITEM_ITEMS_CONTINUE_LORE.getStringList())
.lore(this.player, Settings.GUI_SELL_PLACE_ITEM_ITEMS_CONTINUE_LORE.getStringList())
.make(), click -> {
final ArrayList<ItemStack> items = gatherSellableItems();
@ -133,7 +133,7 @@ public final class GUISellPlaceItem extends AuctionBaseGUI {
setButton(getRows() - 1, 8, QuickItem
.of(this.viewMode == ViewMode.SINGLE_ITEM ? Settings.GUI_SELL_PLACE_ITEM_ITEMS_SINGLE_ITEM.getString() : Settings.GUI_SELL_PLACE_ITEM_ITEMS_BUNDLE_ITEM.getString())
.name(this.viewMode == ViewMode.SINGLE_ITEM ? Settings.GUI_SELL_PLACE_ITEM_ITEMS_SINGLE_NAME.getString() : Settings.GUI_SELL_PLACE_ITEM_ITEMS_BUNDLE_NAME.getString())
.lore(this.player,this.viewMode == ViewMode.SINGLE_ITEM ? Settings.GUI_SELL_PLACE_ITEM_ITEMS_SINGLE_LORE.getStringList() : Settings.GUI_SELL_PLACE_ITEM_ITEMS_BUNDLE_LORE.getStringList())
.lore(this.player, this.viewMode == ViewMode.SINGLE_ITEM ? Settings.GUI_SELL_PLACE_ITEM_ITEMS_SINGLE_LORE.getStringList() : Settings.GUI_SELL_PLACE_ITEM_ITEMS_BUNDLE_LORE.getStringList())
.make(), click -> {
if (auctionPlayer.isAtBundleLimit()) {

View File

@ -66,7 +66,7 @@ public final class GUIStatisticLeaderboard extends AuctionPagedGUI<Pair<UUID, Do
setButton(5, 4, QuickItem.of(Settings.GUI_STATS_LEADERBOARD_ITEMS_STAT_ITEM.getString())
.name(Settings.GUI_STATS_LEADERBOARD_ITEMS_STAT_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_STATS_LEADERBOARD_ITEMS_STAT_LORE.getStringList(), "statistic_name", statisticType.getTranslatedType()))
.lore(this.player, Replacer.replaceVariables(Settings.GUI_STATS_LEADERBOARD_ITEMS_STAT_LORE.getStringList(), "statistic_name", statisticType.getTranslatedType()))
.make(), click -> click.manager.showGUI(click.player, new GUIStatisticLeaderboard(this.auctionPlayer, this.statisticType.next())));
}
@ -79,7 +79,7 @@ public final class GUIStatisticLeaderboard extends AuctionPagedGUI<Pair<UUID, Do
return QuickItem
.of(head)
.name(Settings.GUI_STATS_LEADERBOARD_ITEMS_PLAYER_NAME.getString().replace("%player_name%", targetUser.getName() == null ? "&e&lUsername not found" : targetUser.getName()))
.lore(this.player,Replacer.replaceVariables(Settings.GUI_STATS_LEADERBOARD_ITEMS_PLAYER_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_STATS_LEADERBOARD_ITEMS_PLAYER_LORE.getStringList(),
"player_name", targetUser.getName() == null ? "&e&lUsername not found" : targetUser.getName(),
"auction_statistic_name", statisticType.getTranslatedType(),
"auction_statistic_value", AuctionAPI.getInstance().formatNumber(entry.getSecond())

View File

@ -47,42 +47,42 @@ public final class GUIStatisticView extends AuctionBaseGUI {
setItem(1, 1, QuickItem
.of(isSelf ? Settings.GUI_STATS_SELF_ITEMS_CREATED_AUCTION_ITEM.getString() : Settings.GUI_STATS_SEARCH_ITEMS_CREATED_AUCTION_ITEM.getString())
.name(isSelf ? Settings.GUI_STATS_SELF_ITEMS_CREATED_AUCTION_NAME.getString() : Settings.GUI_STATS_SEARCH_ITEMS_CREATED_AUCTION_NAME.getString())
.lore(this.player,Replacer.replaceVariables(isSelf ? Settings.GUI_STATS_SELF_ITEMS_CREATED_AUCTION_LORE.getStringList() : Settings.GUI_STATS_SEARCH_ITEMS_CREATED_AUCTION_LORE.getStringList(), "created_auctions", (int) AuctionHouse.getInstance().getAuctionStatisticManager().getStatisticByPlayer(targetPlayer.getUuid(), AuctionStatisticType.CREATED_AUCTION)))
.lore(this.player, Replacer.replaceVariables(isSelf ? Settings.GUI_STATS_SELF_ITEMS_CREATED_AUCTION_LORE.getStringList() : Settings.GUI_STATS_SEARCH_ITEMS_CREATED_AUCTION_LORE.getStringList(), "created_auctions", (int) AuctionHouse.getInstance().getAuctionStatisticManager().getStatisticByPlayer(targetPlayer.getUuid(), AuctionStatisticType.CREATED_AUCTION)))
.make());
// sold auction
setItem(3, 1, QuickItem
.of(isSelf ? Settings.GUI_STATS_SELF_ITEMS_SOLD_AUCTION_ITEM.getString() : Settings.GUI_STATS_SEARCH_ITEMS_SOLD_AUCTION_ITEM.getString())
.name(isSelf ? Settings.GUI_STATS_SELF_ITEMS_SOLD_AUCTION_NAME.getString() : Settings.GUI_STATS_SEARCH_ITEMS_SOLD_AUCTION_NAME.getString())
.lore(this.player,Replacer.replaceVariables(isSelf ? Settings.GUI_STATS_SELF_ITEMS_SOLD_AUCTION_LORE.getStringList() : Settings.GUI_STATS_SEARCH_ITEMS_SOLD_AUCTION_LORE.getStringList(), "sold_auctions", (int) AuctionHouse.getInstance().getAuctionStatisticManager().getStatisticByPlayer(targetPlayer.getUuid(), AuctionStatisticType.SOLD_AUCTION)))
.lore(this.player, Replacer.replaceVariables(isSelf ? Settings.GUI_STATS_SELF_ITEMS_SOLD_AUCTION_LORE.getStringList() : Settings.GUI_STATS_SEARCH_ITEMS_SOLD_AUCTION_LORE.getStringList(), "sold_auctions", (int) AuctionHouse.getInstance().getAuctionStatisticManager().getStatisticByPlayer(targetPlayer.getUuid(), AuctionStatisticType.SOLD_AUCTION)))
.make());
// created bin
setItem(1, 4, QuickItem
.of(isSelf ? Settings.GUI_STATS_SELF_ITEMS_CREATED_BIN_ITEM.getString() : Settings.GUI_STATS_SEARCH_ITEMS_CREATED_BIN_ITEM.getString())
.name(isSelf ? Settings.GUI_STATS_SELF_ITEMS_CREATED_BIN_NAME.getString() : Settings.GUI_STATS_SEARCH_ITEMS_CREATED_BIN_NAME.getString())
.lore(this.player,Replacer.replaceVariables(isSelf ? Settings.GUI_STATS_SELF_ITEMS_CREATED_BIN_LORE.getStringList() : Settings.GUI_STATS_SEARCH_ITEMS_CREATED_BIN_LORE.getStringList(), "created_bins", (int) AuctionHouse.getInstance().getAuctionStatisticManager().getStatisticByPlayer(targetPlayer.getUuid(), AuctionStatisticType.CREATED_BIN)))
.lore(this.player, Replacer.replaceVariables(isSelf ? Settings.GUI_STATS_SELF_ITEMS_CREATED_BIN_LORE.getStringList() : Settings.GUI_STATS_SEARCH_ITEMS_CREATED_BIN_LORE.getStringList(), "created_bins", (int) AuctionHouse.getInstance().getAuctionStatisticManager().getStatisticByPlayer(targetPlayer.getUuid(), AuctionStatisticType.CREATED_BIN)))
.make());
// sold bin
setItem(3, 4, QuickItem
.of(isSelf ? Settings.GUI_STATS_SELF_ITEMS_SOLD_BIN_ITEM.getString() : Settings.GUI_STATS_SEARCH_ITEMS_SOLD_BIN_ITEM.getString())
.name(isSelf ? Settings.GUI_STATS_SELF_ITEMS_SOLD_BIN_NAME.getString() : Settings.GUI_STATS_SEARCH_ITEMS_SOLD_BIN_NAME.getString())
.lore(this.player,Replacer.replaceVariables(isSelf ? Settings.GUI_STATS_SELF_ITEMS_SOLD_BIN_LORE.getStringList() : Settings.GUI_STATS_SEARCH_ITEMS_SOLD_BIN_LORE.getStringList(), "sold_bins", (int) AuctionHouse.getInstance().getAuctionStatisticManager().getStatisticByPlayer(targetPlayer.getUuid(), AuctionStatisticType.SOLD_BIN)))
.lore(this.player, Replacer.replaceVariables(isSelf ? Settings.GUI_STATS_SELF_ITEMS_SOLD_BIN_LORE.getStringList() : Settings.GUI_STATS_SEARCH_ITEMS_SOLD_BIN_LORE.getStringList(), "sold_bins", (int) AuctionHouse.getInstance().getAuctionStatisticManager().getStatisticByPlayer(targetPlayer.getUuid(), AuctionStatisticType.SOLD_BIN)))
.make());
// money earned
setItem(1, 7, QuickItem
.of(isSelf ? Settings.GUI_STATS_SELF_ITEMS_MONEY_EARNED_ITEM.getString() : Settings.GUI_STATS_SEARCH_ITEMS_MONEY_EARNED_ITEM.getString())
.name(isSelf ? Settings.GUI_STATS_SELF_ITEMS_MONEY_EARNED_NAME.getString() : Settings.GUI_STATS_SEARCH_ITEMS_MONEY_EARNED_NAME.getString())
.lore(this.player,Replacer.replaceVariables(isSelf ? Settings.GUI_STATS_SELF_ITEMS_MONEY_EARNED_LORE.getStringList() : Settings.GUI_STATS_SEARCH_ITEMS_MONEY_EARNED_LORE.getStringList(), "money_earned", (int) AuctionHouse.getInstance().getAuctionStatisticManager().getStatisticByPlayer(targetPlayer.getUuid(), AuctionStatisticType.MONEY_EARNED)))
.lore(this.player, Replacer.replaceVariables(isSelf ? Settings.GUI_STATS_SELF_ITEMS_MONEY_EARNED_LORE.getStringList() : Settings.GUI_STATS_SEARCH_ITEMS_MONEY_EARNED_LORE.getStringList(), "money_earned", (int) AuctionHouse.getInstance().getAuctionStatisticManager().getStatisticByPlayer(targetPlayer.getUuid(), AuctionStatisticType.MONEY_EARNED)))
.make());
// money spent
setItem(3, 7, QuickItem
.of(isSelf ? Settings.GUI_STATS_SELF_ITEMS_MONEY_SPENT_ITEM.getString() : Settings.GUI_STATS_SEARCH_ITEMS_MONEY_SPENT_ITEM.getString())
.name(isSelf ? Settings.GUI_STATS_SELF_ITEMS_MONEY_SPENT_NAME.getString() : Settings.GUI_STATS_SEARCH_ITEMS_MONEY_SPENT_NAME.getString())
.lore(this.player,Replacer.replaceVariables(isSelf ? Settings.GUI_STATS_SELF_ITEMS_MONEY_SPENT_LORE.getStringList() : Settings.GUI_STATS_SEARCH_ITEMS_MONEY_SPENT_LORE.getStringList(), "money_spent", (int) AuctionHouse.getInstance().getAuctionStatisticManager().getStatisticByPlayer(targetPlayer.getUuid(), AuctionStatisticType.MONEY_SPENT)))
.lore(this.player, Replacer.replaceVariables(isSelf ? Settings.GUI_STATS_SELF_ITEMS_MONEY_SPENT_LORE.getStringList() : Settings.GUI_STATS_SEARCH_ITEMS_MONEY_SPENT_LORE.getStringList(), "money_spent", (int) AuctionHouse.getInstance().getAuctionStatisticManager().getStatisticByPlayer(targetPlayer.getUuid(), AuctionStatisticType.MONEY_SPENT)))
.make());
}
}

View File

@ -41,12 +41,12 @@ public final class GUIStatisticViewSelect extends AuctionBaseGUI {
// self
setButton(1, 2, QuickItem.of(Settings.GUI_STATS_VIEW_SELECT_ITEMS_PERSONAL_USE_HEAD.getBoolean() ? AuctionAPI.getInstance().getPlayerHead(this.player.getName()) : QuickItem.of(Settings.GUI_STATS_VIEW_SELECT_ITEMS_PERSONAL_ITEM.getString()).make())
.name(Settings.GUI_STATS_VIEW_SELECT_ITEMS_PERSONAL_NAME.getString())
.lore(this.player,Settings.GUI_STATS_VIEW_SELECT_ITEMS_PERSONAL_LORE.getStringList())
.lore(this.player, Settings.GUI_STATS_VIEW_SELECT_ITEMS_PERSONAL_LORE.getStringList())
.make(), click -> click.manager.showGUI(click.player, new GUIStatisticView(this.auctionPlayer, this.auctionPlayer)));
setButton(1, 6, QuickItem.of(Settings.GUI_STATS_VIEW_SELECT_ITEMS_LEADERBOARD_ITEM.getString())
.name(Settings.GUI_STATS_VIEW_SELECT_ITEMS_LEADERBOARD_NAME.getString())
.lore(this.player,Settings.GUI_STATS_VIEW_SELECT_ITEMS_LEADERBOARD_LORE.getStringList())
.lore(this.player, Settings.GUI_STATS_VIEW_SELECT_ITEMS_LEADERBOARD_LORE.getStringList())
.make(), click -> click.manager.showGUI(click.player, new GUIStatisticLeaderboard(this.auctionPlayer, AuctionStatisticType.MONEY_EARNED)));
}
}

View File

@ -123,7 +123,7 @@ public class GUITransactionList extends AuctionPagedGUI<Transaction> {
setButton(Settings.GUI_TRANSACTIONS_ITEMS_FILTER_SLOT.getInt(), QuickItem
.of(Settings.GUI_TRANSACTIONS_ITEMS_FILTER_ITEM.getString())
.name(Settings.GUI_TRANSACTIONS_ITEMS_FILTER_NAME.getString())
.lore(this.player,Replacer.replaceVariables(Settings.GUI_TRANSACTIONS_ITEMS_FILTER_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_TRANSACTIONS_ITEMS_FILTER_LORE.getStringList(),
"filter_category", auctionPlayer.getSelectedTransactionFilter().getTranslatedType(),
"filter_auction_type", auctionPlayer.getSelectedTransactionSaleType().getTranslatedType(),
"filter_sort_order", auctionPlayer.getTransactionSortType().getTranslatedType(),
@ -173,7 +173,7 @@ public class GUITransactionList extends AuctionPagedGUI<Transaction> {
return QuickItem
.of(item)
.name(Replacer.replaceVariables(Settings.GUI_TRANSACTIONS_ITEM_TRANSACTION_NAME.getString(), "item_name", AuctionAPI.getInstance().getItemName(item), "transaction_id", transaction.getId().toString()))
.lore(this.player,Replacer.replaceVariables(Settings.GUI_TRANSACTIONS_ITEM_TRANSACTION_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_TRANSACTIONS_ITEM_TRANSACTION_LORE.getStringList(),
"transaction_id", transaction.getId().toString(),
"seller", seller.hasPlayedBefore() ? seller.getName() : SERVER_LISTING_NAME,
"buyer", Bukkit.getOfflinePlayer(transaction.getBuyer()).getName(),

View File

@ -58,7 +58,7 @@ public final class GUITransactionType extends AuctionBaseGUI {
setButton(11, QuickItem
.of(Settings.GUI_TRANSACTIONS_TYPE_ITEMS_ALL_TRANSACTIONS_ITEM.getString())
.name(Settings.GUI_TRANSACTIONS_TYPE_ITEMS_ALL_TRANSACTIONS_NAME.getString())
.lore(this.player,Settings.GUI_TRANSACTIONS_TYPE_ITEMS_ALL_TRANSACTIONS_LORE.getStringList())
.lore(this.player, Settings.GUI_TRANSACTIONS_TYPE_ITEMS_ALL_TRANSACTIONS_LORE.getStringList())
.make(), e -> {
if (Settings.RESTRICT_ALL_TRANSACTIONS_TO_PERM.getBoolean() && !e.player.hasPermission("auctionhouse.transactions.viewall")) {
@ -72,7 +72,7 @@ public final class GUITransactionType extends AuctionBaseGUI {
setButton(15, QuickItem
.of(Settings.GUI_TRANSACTIONS_TYPE_ITEMS_SELF_TRANSACTIONS_ITEM.getString())
.name(Settings.GUI_TRANSACTIONS_TYPE_ITEMS_SELF_TRANSACTIONS_NAME.getString())
.lore(this.player,Settings.GUI_TRANSACTIONS_TYPE_ITEMS_SELF_TRANSACTIONS_LORE.getStringList())
.lore(this.player, Settings.GUI_TRANSACTIONS_TYPE_ITEMS_SELF_TRANSACTIONS_LORE.getStringList())
.make(), e -> e.manager.showGUI(e.player, new GUITransactionList(e.player, false)));
if (player.isOp() || player.hasPermission("auctionhouse.admin")) {
@ -80,7 +80,7 @@ public final class GUITransactionType extends AuctionBaseGUI {
setButton(3, 8, QuickItem
.of(Settings.GUI_TRANSACTIONS_TYPE_ITEMS_DELETE_ITEM.getString())
.name(Settings.GUI_TRANSACTIONS_TYPE_ITEMS_DELETE_NAME.getString())
.lore(this.player,Settings.GUI_TRANSACTIONS_TYPE_ITEMS_DELETE_LORE.getStringList())
.lore(this.player, Settings.GUI_TRANSACTIONS_TYPE_ITEMS_DELETE_LORE.getStringList())
.make(), e -> {
e.gui.close();

View File

@ -62,7 +62,7 @@ public class GUITransactionView extends AuctionBaseGUI {
setItem(3, 2, QuickItem
.of(AuctionAPI.getInstance().getPlayerHead(seller.getName()))
.name(Replacer.replaceVariables(Settings.GUI_TRANSACTION_VIEW_ITEM_SELLER_NAME.getString(), "seller", seller.hasPlayedBefore() ? seller.getName() : SERVER_LISTING_NAME))
.lore(this.player,Replacer.replaceVariables(Settings.GUI_TRANSACTION_VIEW_ITEM_SELLER_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_TRANSACTION_VIEW_ITEM_SELLER_LORE.getStringList(),
"transaction_id", transaction.getId().toString(),
"seller", seller.hasPlayedBefore() ? seller.getName() : SERVER_LISTING_NAME,
"buyer", buyer.getName(),
@ -72,7 +72,7 @@ public class GUITransactionView extends AuctionBaseGUI {
setItem(3, 6, QuickItem
.of(AuctionAPI.getInstance().getPlayerHead(Bukkit.getOfflinePlayer(transaction.getBuyer()).getName()))
.name(Replacer.replaceVariables(Settings.GUI_TRANSACTION_VIEW_ITEM_BUYER_NAME.getString(), "buyer", buyer.getName()))
.lore(this.player,Replacer.replaceVariables(Settings.GUI_TRANSACTION_VIEW_ITEM_BUYER_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_TRANSACTION_VIEW_ITEM_BUYER_LORE.getStringList(),
"transaction_id", transaction.getId().toString(),
"seller", seller.hasPlayedBefore() ? seller.getName() : SERVER_LISTING_NAME,
"buyer", buyer.getName(),
@ -83,7 +83,7 @@ public class GUITransactionView extends AuctionBaseGUI {
setItem(3, 4, QuickItem
.of(Settings.GUI_TRANSACTION_VIEW_ITEM_INFO_ITEM.getString())
.name(Replacer.replaceVariables(Settings.GUI_TRANSACTION_VIEW_ITEM_INFO_NAME.getString(), "transaction_id", transaction.getId().toString()))
.lore(this.player,Replacer.replaceVariables(Settings.GUI_TRANSACTION_VIEW_ITEM_INFO_LORE.getStringList(),
.lore(this.player, Replacer.replaceVariables(Settings.GUI_TRANSACTION_VIEW_ITEM_INFO_LORE.getStringList(),
"transaction_id", transaction.getId().toString(),
"sale_type", transaction.getAuctionSaleType() == AuctionSaleType.USED_BIDDING_SYSTEM ? AuctionHouse.getInstance().getLocale().getMessage("transaction.sale_type.bid_won").getMessage() : AuctionHouse.getInstance().getLocale().getMessage("transaction.sale_type.immediate_buy").getMessage(),
"transaction_date", AuctionAPI.getInstance().convertMillisToDate(transaction.getTransactionTime()),

View File

@ -28,10 +28,8 @@ import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.auctionhouse.events.AuctionStartEvent;
import ca.tweetzy.auctionhouse.managers.SoundManager;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.core.utils.PlayerUtils;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.flight.utils.Common;
import lombok.NonNull;
import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit;
@ -108,15 +106,15 @@ public final class AuctionCreator {
// check tax
if (Settings.TAX_ENABLED.getBoolean() && Settings.TAX_CHARGE_LISTING_FEE.getBoolean() && !auctionItem.isServerItem() && !auctionItem.isRequest()) {
if (!EconomyManager.hasBalance(seller, listingFee)) {
if (!AuctionHouse.getCurrencyManager().has(seller, listingFee)) {
instance.getLocale().getMessage("auction.tax.cannotpaylistingfee").processPlaceholder("price", AuctionAPI.getInstance().formatNumber(listingFee)).sendPrefixedMessage(seller);
result.accept(auctionItem, CANNOT_PAY_LISTING_FEE);
return;
}
EconomyManager.withdrawBalance(seller, listingFee);
AuctionHouse.getCurrencyManager().withdraw(seller, listingFee);
AuctionHouse.getInstance().getLocale().getMessage("auction.tax.paidlistingfee").processPlaceholder("price", AuctionAPI.getInstance().formatNumber(listingFee)).sendPrefixedMessage(seller);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(seller))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(listingFee)).sendPrefixedMessage(seller);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(seller))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(listingFee)).sendPrefixedMessage(seller);
}
// final item adjustments
@ -215,8 +213,8 @@ public final class AuctionCreator {
PaymentReason.LISTING_FAILED
), null);
else
EconomyManager.deposit(seller, listingFee);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(seller))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(listingFee)).sendPrefixedMessage(seller);
AuctionHouse.getCurrencyManager().deposit(seller, listingFee);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(seller))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(listingFee)).sendPrefixedMessage(seller);
}
result.accept(auctionItem, UNKNOWN);

View File

@ -18,5 +18,7 @@
package ca.tweetzy.auctionhouse.impl;
public final class AuctionAPI {
import ca.tweetzy.auctionhouse.api.AuctionHouseAPI;
public final class AuctionAPI implements AuctionHouseAPI {
}

View File

@ -0,0 +1,53 @@
package ca.tweetzy.auctionhouse.impl.currency;
import ca.tweetzy.auctionhouse.api.currency.AbstractCurrency;
import ca.tweetzy.flight.utils.PlayerUtil;
import org.bukkit.OfflinePlayer;
import org.bukkit.inventory.ItemStack;
public final class ItemCurrency extends AbstractCurrency {
public ItemCurrency() {
super("Markets", "Item", "&bCustom Item");
}
public boolean has(OfflinePlayer player, double amount, ItemStack item) {
if (player == null || player.getPlayer() == null || !player.isOnline()) return false;
return PlayerUtil.getItemCountInPlayerInventory(player.getPlayer(), item) >= amount;
}
public boolean withdraw(OfflinePlayer player, double amount, ItemStack item) {
if (player == null || player.getPlayer() == null || !player.isOnline()) return false;
PlayerUtil.removeSpecificItemQuantityFromPlayer(player.getPlayer(), item, (int) amount);
return true;
}
public boolean deposit(OfflinePlayer player, double amount, ItemStack item) {
if (player == null || player.getPlayer() == null || !player.isOnline()) return false;
for (int i = 0; i < amount; i++)
PlayerUtil.giveItem(player.getPlayer(), item);
return true;
}
@Override
public double getBalance(OfflinePlayer player) {
return 0;
}
@Override
public boolean has(OfflinePlayer player, double amount) {
return false;
}
@Override
public boolean withdraw(OfflinePlayer player, double amount) {
return false;
}
@Override
public boolean deposit(OfflinePlayer player, double amount) {
return false;
}
}

View File

@ -0,0 +1,57 @@
package ca.tweetzy.auctionhouse.impl.currency;
import ca.tweetzy.auctionhouse.api.currency.IconableCurrency;
import ca.tweetzy.flight.comp.enums.CompMaterial;
import me.TechsCode.UltraEconomy.UltraEconomy;
import me.TechsCode.UltraEconomy.objects.Account;
import me.TechsCode.UltraEconomy.objects.Currency;
import org.bukkit.OfflinePlayer;
public final class UltraEconomyCurrency extends IconableCurrency {
private final Currency currency;
public UltraEconomyCurrency(String currencyName) {
super("UltraEconomy", currencyName, "", CompMaterial.PAPER.parseItem());
this.currency = UltraEconomy.getInstance().getCurrencies().name(currencyName).orElse(null);
if (this.currency != null) {
setDisplayName(this.currency.getName());
}
}
@Override
public boolean has(OfflinePlayer player, double amount) {
final Account account = UltraEconomy.getInstance().getAccounts().uuid(player.getUniqueId()).orElse(null);
if (account == null) return false;
return account.getBalance(this.currency).getSum() >= amount;
}
@Override
public boolean withdraw(OfflinePlayer player, double amount) {
final Account account = UltraEconomy.getInstance().getAccounts().uuid(player.getUniqueId()).orElse(null);
if (account == null) return false;
account.removeBalance(this.currency, amount);
return true;
}
@Override
public boolean deposit(OfflinePlayer player, double amount) {
final Account account = UltraEconomy.getInstance().getAccounts().uuid(player.getUniqueId()).orElse(null);
if (account == null) return false;
account.addBalance(this.currency, amount);
return true;
}
@Override
public double getBalance(OfflinePlayer player) {
final Account account = UltraEconomy.getInstance().getAccounts().uuid(player.getUniqueId()).orElse(null);
if (account == null) return 0;
return account.getBalance(this.currency).getSum();
}
}

View File

@ -0,0 +1,33 @@
package ca.tweetzy.auctionhouse.impl.currency;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.currency.AbstractCurrency;
import ca.tweetzy.auctionhouse.settings.Settings;
import org.bukkit.OfflinePlayer;
public final class VaultCurrency extends AbstractCurrency {
public VaultCurrency() {
super("Vault", "Vault", Settings.CURRENCY_VAULT_SYMBOL.getString());
}
@Override
public boolean has(OfflinePlayer player, double amount) {
return AuctionHouse.getEconomy().has(player, amount);
}
@Override
public boolean withdraw(OfflinePlayer player, double amount) {
return AuctionHouse.getEconomy().withdrawPlayer(player, amount).transactionSuccess();
}
@Override
public boolean deposit(OfflinePlayer player, double amount) {
return AuctionHouse.getEconomy().depositPlayer(player, amount).transactionSuccess();
}
@Override
public double getBalance(OfflinePlayer player) {
return AuctionHouse.getEconomy().getBalance(player);
}
}

View File

@ -25,7 +25,6 @@ import ca.tweetzy.auctionhouse.api.sync.Storeable;
import ca.tweetzy.auctionhouse.api.sync.Unstoreable;
import lombok.AllArgsConstructor;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.Nullable;
import java.util.function.Consumer;
@ -36,17 +35,12 @@ public abstract class AuctionItem implements Auction, Storeable<AuctionItem>, Un
protected final ListingType listingType;
@Override
public void unStore(@Nullable Consumer<ListingDeleteResult> result) {
// AuctionHouse.getDataManager().deleteListing(this, (error, status) -> {
// if (error != null && result != null) {
// error.printStackTrace();
// result.accept(ListingDeleteResult.NOT_DELETED);
// return;
// }
//
// if (result != null)
// result.accept(status);
//
// });
public void store(Consumer<AuctionItem> stored) {
}
}
@Override
public void sync(Consumer<Boolean> wasSuccess) {
}
}

View File

@ -29,7 +29,6 @@ import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.function.Consumer;
public class BinListing extends AuctionItem {
@ -164,10 +163,6 @@ public class BinListing extends AuctionItem {
this.currency = currency;
}
public void setCurrencyItem(ItemStack currencyItem) {
this.currencyItem = currencyItem;
}
@Override
public void setBinPrice(double binPrice) {
this.binPrice = binPrice;
@ -193,21 +188,6 @@ public class BinListing extends AuctionItem {
return 0;
}
@Override
public void sync(Consumer<Boolean> wasSuccess) {
}
@Override
public void store(Consumer<AuctionItem> stored) {
// AuctionHouse.getDataManager().createListing(this, (error, created) -> {
// if (error != null) return;
//
// if (stored != null)
// stored.accept(created);
// });
}
@Override
public List<String> getDisplayLore(@NonNull ListingDisplayMode displayMode) {
final List<String> displayLore = new ArrayList<>(ItemUtil.getItemLore(this.item));

View File

@ -92,7 +92,6 @@ public class PlayerListeners implements Listener {
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) return;
final Player player = event.getPlayer();
AuctionHouse.getInstance().getAuctionPlayerManager().addPlayer(player);
}
@EventHandler(priority = EventPriority.HIGH)
@ -101,24 +100,22 @@ public class PlayerListeners implements Listener {
final AuctionHouse instance = AuctionHouse.getInstance();
Titles.sendTitle(player, 1, 1, 1, " ", " ");
// instance.getAuctionPlayerManager().addPlayer(player);
// DUPE TRACKING
for (ItemStack item : player.getInventory().getStorageContents()) {
if (item == null || item.getType() == XMaterial.AIR.parseMaterial() || item.getAmount() == 0) continue;
AuctionHouse.newChain().async(() -> {
for (ItemStack item : player.getInventory().getStorageContents()) {
if (item == null || item.getType() == XMaterial.AIR.parseMaterial() || item.getAmount() == 0) continue;
final UUID auctionItemId = NBT.get(item, nbt -> (UUID) nbt.getUUID("AuctionDupeTracking"));
if (auctionItemId == null) return;
final UUID auctionItemId = NBT.get(item, nbt -> (UUID) nbt.getUUID("AuctionDupeTracking"));
if (auctionItemId == null) continue;
if (AuctionHouse.getInstance().getAuctionItemManager().getItem(auctionItemId) != null) {
player.getInventory().remove(item);
Bukkit.getServer().getConsoleSender().sendMessage(Common.colorize("&8[&eAuctionHouse&8] &CRemoving duped item from " + player.getName() + "'s inventory!"));
if (AuctionHouse.getInstance().getAuctionItemManager().getItem(auctionItemId) != null) {
player.getInventory().remove(item);
Bukkit.getServer().getConsoleSender().sendMessage(Common.colorize("&8[&eAuctionHouse&8] &CRemoving duped item from " + player.getName() + "'s inventory!"));
}
}
}
}).execute();
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(AuctionHouse.getInstance(), () -> {
if (Settings.UPDATE_CHECKER.getBoolean() && instance.getStatus() == UpdateChecker.UpdateStatus.UNRELEASED_VERSION && player.isOp()) {
instance.getLocale().newMessage(TextUtils.formatText(String.format("&dYou're running an unreleased version of Auction House &f(&c%s&f)", instance.getDescription().getVersion()))).sendPrefixedMessage(player);
}

View File

@ -0,0 +1,17 @@
package ca.tweetzy.auctionhouse.model.currency;
import ca.tweetzy.auctionhouse.api.currency.AbstractCurrency;
import lombok.NonNull;
import java.util.List;
public abstract class CurrencyLoader {
protected String owningPlugin;
public CurrencyLoader(@NonNull final String owningPlugin) {
this.owningPlugin = owningPlugin;
}
public abstract List<AbstractCurrency> getCurrencies();
}

View File

@ -0,0 +1,43 @@
package ca.tweetzy.auctionhouse.model.currency;
import ca.tweetzy.auctionhouse.api.currency.AbstractCurrency;
import ca.tweetzy.auctionhouse.impl.currency.UltraEconomyCurrency;
import ca.tweetzy.auctionhouse.settings.Settings;
import me.TechsCode.UltraEconomy.UltraEconomy;
import me.TechsCode.UltraEconomy.objects.Currency;
import java.util.ArrayList;
import java.util.List;
public final class UltraEconomyLoader extends CurrencyLoader {
public UltraEconomyLoader() {
super("UltraEconomy");
}
@Override
public List<AbstractCurrency> getCurrencies() {
final List<AbstractCurrency> currencies = new ArrayList<>();
for (Currency currency : UltraEconomy.getInstance().getCurrencies()) {
boolean blackListed = false;
for (String blacklisted : Settings.CURRENCY_BLACKLISTED.getStringList()) {
final String[] blacklistSplit = blacklisted.split(":");
if (blacklistSplit.length != 2) continue;
if (!blacklistSplit[0].equalsIgnoreCase(this.owningPlugin)) continue;
if (blacklistSplit[1].equalsIgnoreCase(currency.getName()))
blackListed = true;
}
if (!blackListed)
currencies.add(new UltraEconomyCurrency(currency.getName()));
}
return currencies;
}
}

View File

@ -0,0 +1,102 @@
package ca.tweetzy.auctionhouse.model.manager;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.currency.AbstractCurrency;
import ca.tweetzy.auctionhouse.api.manager.ListManager;
import ca.tweetzy.auctionhouse.impl.currency.ItemCurrency;
import ca.tweetzy.auctionhouse.impl.currency.VaultCurrency;
import ca.tweetzy.auctionhouse.model.currency.UltraEconomyLoader;
import ca.tweetzy.auctionhouse.settings.Settings;
import lombok.NonNull;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.inventory.ItemStack;
public final class CurrencyManager extends ListManager<AbstractCurrency> {
public CurrencyManager() {
super("Currency");
}
public AbstractCurrency locateCurrency(@NonNull final String owningPlugin, @NonNull final String currencyName) {
return getManagerContent().stream().filter(currency -> currency.getOwningPlugin().equals(owningPlugin) && currency.getCurrencyName().equals(currencyName)).findFirst().orElse(null);
}
public boolean has(@NonNull final OfflinePlayer offlinePlayer, @NonNull final String owningPlugin, @NonNull final String currencyName, final double amount) {
if (owningPlugin.equalsIgnoreCase("vault") || currencyName.equalsIgnoreCase("vault"))
return AuctionHouse.getEconomy().has(offlinePlayer, amount);
return locateCurrency(owningPlugin, currencyName).has(offlinePlayer, amount);
}
public double getBalance(@NonNull final OfflinePlayer offlinePlayer, @NonNull final String owningPlugin, @NonNull final String currencyName) {
if (owningPlugin.equalsIgnoreCase("vault") || currencyName.equalsIgnoreCase("vault"))
return AuctionHouse.getEconomy().getBalance(offlinePlayer);
return locateCurrency(owningPlugin, currencyName).getBalance(offlinePlayer);
}
public boolean withdraw(@NonNull final OfflinePlayer offlinePlayer, @NonNull final String owningPlugin, @NonNull final String currencyName, final double amount) {
if (owningPlugin.equalsIgnoreCase("vault") || currencyName.equalsIgnoreCase("vault")) {
AuctionHouse.getEconomy().withdrawPlayer(offlinePlayer, amount);
return true;
}
return locateCurrency(owningPlugin, currencyName).withdraw(offlinePlayer, amount);
}
public boolean deposit(@NonNull final OfflinePlayer offlinePlayer, @NonNull final String owningPlugin, @NonNull final String currencyName, final double amount) {
if (owningPlugin.equalsIgnoreCase("vault") || currencyName.equalsIgnoreCase("vault")) {
AuctionHouse.getEconomy().depositPlayer(offlinePlayer, amount);
return true;
}
return locateCurrency(owningPlugin, currencyName).deposit(offlinePlayer, amount);
}
public boolean has(@NonNull final OfflinePlayer offlinePlayer, @NonNull final ItemStack itemStack, final int amount) {
return ((ItemCurrency) locateCurrency("Markets", "Item")).has(offlinePlayer, amount, itemStack);
}
public boolean withdraw(@NonNull final OfflinePlayer offlinePlayer, @NonNull final ItemStack itemStack, final int amount) {
return ((ItemCurrency) locateCurrency("Markets", "Item")).withdraw(offlinePlayer, amount, itemStack);
}
public boolean deposit(@NonNull final OfflinePlayer offlinePlayer, @NonNull final ItemStack itemStack, final int amount) {
return ((ItemCurrency) locateCurrency("Markets", "Item")).deposit(offlinePlayer, amount, itemStack);
}
public boolean has(@NonNull final OfflinePlayer offlinePlayer, final double amount) {
final String[] CURRENCY_DEFAULT = Settings.CURRENCY_DEFAULT_SELECTED.getString().split("/");
return has(offlinePlayer, CURRENCY_DEFAULT[0], CURRENCY_DEFAULT[1], amount);
}
public boolean withdraw(@NonNull final OfflinePlayer offlinePlayer, final double amount) {
final String[] CURRENCY_DEFAULT = Settings.CURRENCY_DEFAULT_SELECTED.getString().split("/");
return withdraw(offlinePlayer, CURRENCY_DEFAULT[0], CURRENCY_DEFAULT[1], amount);
}
public boolean deposit(@NonNull final OfflinePlayer offlinePlayer, final double amount) {
final String[] CURRENCY_DEFAULT = Settings.CURRENCY_DEFAULT_SELECTED.getString().split("/");
return deposit(offlinePlayer, CURRENCY_DEFAULT[0], CURRENCY_DEFAULT[1], amount);
}
public double getBalance(@NonNull final OfflinePlayer offlinePlayer) {
final String[] CURRENCY_DEFAULT = Settings.CURRENCY_DEFAULT_SELECTED.getString().split("/");
return getBalance(offlinePlayer, CURRENCY_DEFAULT[0], CURRENCY_DEFAULT[1]);
}
@Override
public void load() {
clear();
// add vault by default
add(new VaultCurrency());
// add(new ItemCurrency());
// load currencies from providers that allow multiple currencies
if (Bukkit.getServer().getPluginManager().isPluginEnabled("UltraEconomy"))
new UltraEconomyLoader().getCurrencies().forEach(this::add);
}
}

View File

@ -47,6 +47,11 @@ public class Settings {
"You have the following supported economy plugins installed: \"" + EconomyManager.getManager().getPossiblePlugins().stream().collect(Collectors.joining("\", \"")) + "\"."
);
public static final ConfigSetting CURRENCY_DEFAULT_SELECTED = new ConfigSetting(config, "settings.currency.default selection", "Vault/Vault", "The default currency selection, PluginName/CurrencyName -> Ex. Vault/Vault or UltraEconomy/Gems etc");
public static final ConfigSetting CURRENCY_VAULT_SYMBOL = new ConfigSetting(config, "settings.currency.vault symbol", "$", "When using default/vault currency, what symbol should be used.");
public static final ConfigSetting CURRENCY_BLACKLISTED = new ConfigSetting(config, "settings.currency.black listed", Collections.singletonList("UltraEconomy:Test"), "A list of owning plugins & the currency to be blacklisted. Ex. UltraEconomy:Test");
public static final ConfigSetting ALLOW_USAGE_OF_IN_GAME_EDITOR = new ConfigSetting(config, "Allow Usage Of This Menu In Game", true, "Once you set this to true, you will no longer be able to access it unless you enable it within the actual config.yml");
public static final ConfigSetting UPDATE_CHECKER = new ConfigSetting(config, "update checker", true, "If true, auction house will check for updates periodically");

View File

@ -46,6 +46,18 @@ public final class Settings extends SettingTemp {
public static ConfigEntry MYSQL_PASSWORD = create("settings.mysql.password", "password123", "The password of the database");
public static ConfigEntry MYSQL_PARAMS = create("settings.mysql.params", "?useUnicode=yes&characterEncoding=UTF-8&useServerPrepStmts=false&rewriteBatchedStatements=true&useSSL=true", "Do not touch this if you don't know what your doing");
/*
==============================================================
Economy Settings
==============================================================
*/
public static ConfigEntry CURRENCY_ALLOW_PICK = create("settings.currency.allow user to pick", true).withComment("If true, players will be able to select which currency they want to use.");
public static ConfigEntry CURRENCY_DEFAULT_SELECTED = create("settings.currency.default selection", "Vault/Vault").withComment("The default currency selection, PluginName/CurrencyName -> Ex. Vault/Vault");
public static ConfigEntry CURRENCY_ITEM_DEFAULT_SELECTED = create("settings.currency.default item selection", "DIAMOND").withComment("The default currency selection if using item only mode");
public static ConfigEntry CURRENCY_VAULT_SYMBOL = create("settings.currency.vault symbol", "$").withComment("When using default/vault currency, what symbol should be used.");
public static ConfigEntry CURRENCY_USE_ITEM_ONLY = create("settings.currency.use item only", false).withComment("If true, Auction House will only allow the usage of another item for currency.");
public static ConfigEntry CURRENCY_BLACKLISTED = create("settings.currency.black listed", Collections.singletonList("UltraEconomy:Test")).withComment("A list of owning plugins & the currency to be blacklisted. Ex. UltraEconomy:Test");
/*
==============================================================
TBD
@ -88,7 +100,6 @@ public final class Settings extends SettingTemp {
public static ConfigEntry DATE_FORMAT = create("settings.formatting.date format", "MMMM/dd/yyyy - hh:mm a", "The default date format to be used");
public static ConfigEntry TIME_FORMAT = create("settings.formatting.time format", "hh:mm:ss a", "The default time format to be used");
public static ConfigEntry DATETIME_FORMAT = create("settings.formatting.datetime format", "MMMM/dd/yyyy - hh:mm:ss a", "The default combined date/time format to be used");
public static ConfigEntry CURRENCY_FORMAT = create("settings.formatting.number format", "%,.2f", "The default currency formatting (#,###.##)");
/*

View File

@ -24,7 +24,6 @@ import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType;
import ca.tweetzy.auctionhouse.events.AuctionEndEvent;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.core.utils.PlayerUtils;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.flight.nbtapi.NBT;
@ -64,8 +63,7 @@ public class TickAuctionsTask extends BukkitRunnable {
public void run() {
clock += Settings.TICK_UPDATE_TIME.getInt();
final AuctionHouse instance = AuctionHouse.getInstance();
Set<Map.Entry<UUID, AuctionedItem>> entrySet = instance.getAuctionItemManager().getItems().entrySet();
Set<Map.Entry<UUID, AuctionedItem>> entrySet = AuctionHouse.getAuctionItemManager().getItems().entrySet();
Iterator<Map.Entry<UUID, AuctionedItem>> auctionItemIterator = entrySet.iterator();
@ -74,26 +72,26 @@ public class TickAuctionsTask extends BukkitRunnable {
AuctionedItem auctionItem = entry.getValue();
ItemStack itemStack = auctionItem.getItem();
if (instance.getAuctionItemManager().getGarbageBin().containsKey(auctionItem.getId())) {
instance.getAuctionItemManager().getGarbageBin().remove(auctionItem.getId());
instance.getAuctionItemManager().getDeletedItems().put(auctionItem.getId(), auctionItem);
if (AuctionHouse.getAuctionItemManager().getGarbageBin().containsKey(auctionItem.getId())) {
AuctionHouse.getAuctionItemManager().getGarbageBin().remove(auctionItem.getId());
AuctionHouse.getAuctionItemManager().getDeletedItems().put(auctionItem.getId(), auctionItem);
auctionItemIterator.remove();
continue;
}
// begin the scuffed deletion
if (!instance.getAuctionItemManager().getDeletedItems().keySet().isEmpty()) {
if (!AuctionHouse.getAuctionItemManager().getDeletedItems().keySet().isEmpty()) {
if (Settings.GARBAGE_DELETION_TIMED_MODE.getBoolean() && clock % Settings.GARBAGE_DELETION_TIMED_DELAY.getInt() == 0) {
instance.getDataManager().deleteItemsAsync(instance.getAuctionItemManager().getDeletedItems().values().stream().map(AuctionedItem::getId).collect(Collectors.toList()));
AuctionHouse.getDataManager().deleteItemsAsync(AuctionHouse.getAuctionItemManager().getDeletedItems().values().stream().map(AuctionedItem::getId).collect(Collectors.toList()));
if (!Settings.DISABLE_CLEANUP_MSG.getBoolean())
instance.getLocale().newMessage(TextUtils.formatText("&aCleaned a total of &e" + instance.getAuctionItemManager().getDeletedItems().size() + "&a items.")).sendPrefixedMessage(Bukkit.getConsoleSender());
instance.getAuctionItemManager().getDeletedItems().clear();
AuctionHouse.getInstance().getLocale().newMessage(TextUtils.formatText("&aCleaned a total of &e" + AuctionHouse.getAuctionItemManager().getDeletedItems().size() + "&a items.")).sendPrefixedMessage(Bukkit.getConsoleSender());
AuctionHouse.getAuctionItemManager().getDeletedItems().clear();
} else {
if (instance.getAuctionItemManager().getDeletedItems().size() >= Settings.GARBAGE_DELETION_MAX_ITEMS.getInt()) {
instance.getDataManager().deleteItemsAsync(instance.getAuctionItemManager().getDeletedItems().values().stream().map(AuctionedItem::getId).collect(Collectors.toList()));
if (AuctionHouse.getAuctionItemManager().getDeletedItems().size() >= Settings.GARBAGE_DELETION_MAX_ITEMS.getInt()) {
AuctionHouse.getDataManager().deleteItemsAsync(AuctionHouse.getAuctionItemManager().getDeletedItems().values().stream().map(AuctionedItem::getId).collect(Collectors.toList()));
if (!Settings.DISABLE_CLEANUP_MSG.getBoolean())
instance.getLocale().newMessage(TextUtils.formatText("&aCleaned a total of &e" + instance.getAuctionItemManager().getDeletedItems().size() + "&a items.")).sendPrefixedMessage(Bukkit.getConsoleSender());
instance.getAuctionItemManager().getDeletedItems().clear();
AuctionHouse.getInstance().getLocale().newMessage(TextUtils.formatText("&aCleaned a total of &e" + AuctionHouse.getAuctionItemManager().getDeletedItems().size() + "&a items.")).sendPrefixedMessage(Bukkit.getConsoleSender());
AuctionHouse.getAuctionItemManager().getDeletedItems().clear();
}
}
}
@ -108,7 +106,7 @@ public class TickAuctionsTask extends BukkitRunnable {
if (!auctionItem.isExpired()) {
if (Settings.BROADCAST_AUCTION_ENDING.getBoolean()) {
if (timeRemaining <= Settings.BROADCAST_AUCTION_ENDING_AT_TIME.getInt() && timeRemaining % 10 == 0 && timeRemaining != 0) {
Bukkit.getOnlinePlayers().forEach(player -> instance.getLocale().getMessage("auction.broadcast.ending")
Bukkit.getOnlinePlayers().forEach(player -> AuctionHouse.getInstance().getLocale().getMessage("auction.broadcast.ending")
.processPlaceholder("item", AuctionAPI.getInstance().getItemName(itemStack))
.processPlaceholder("seconds", timeRemaining)
.sendPrefixedMessage(player));
@ -121,7 +119,7 @@ public class TickAuctionsTask extends BukkitRunnable {
// the owner is the highest bidder, so just expire
if (auctionItem.getHighestBidder().equals(auctionItem.getOwner())) {
if (auctionItem.isServerItem() || auctionItem.isRequest())
instance.getAuctionItemManager().sendToGarbage(auctionItem);
AuctionHouse.getAuctionItemManager().sendToGarbage(auctionItem);
else
auctionItem.setExpired(true);
continue;
@ -133,9 +131,9 @@ public class TickAuctionsTask extends BukkitRunnable {
double tax = Settings.TAX_ENABLED.getBoolean() ? (Settings.TAX_SALES_TAX_AUCTION_WON_PERCENTAGE.getDouble() / 100) * auctionItem.getCurrentPrice() : 0D;
if (!Settings.BIDDING_TAKES_MONEY.getBoolean())
if (!EconomyManager.hasBalance(auctionWinner, Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice + tax : finalPrice)) {
if (!AuctionHouse.getCurrencyManager().has(auctionWinner, Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice + tax : finalPrice)) {
if (auctionItem.isServerItem())
instance.getAuctionItemManager().sendToGarbage(auctionItem);
AuctionHouse.getAuctionItemManager().sendToGarbage(auctionItem);
else
auctionItem.setExpired(true);
continue;
@ -143,7 +141,7 @@ public class TickAuctionsTask extends BukkitRunnable {
AuctionEndEvent auctionEndEvent = new AuctionEndEvent(Bukkit.getOfflinePlayer(auctionItem.getOwner()), auctionWinner, auctionItem, AuctionSaleType.USED_BIDDING_SYSTEM, tax);
instance.getServer().getPluginManager().callEvent(auctionEndEvent);
AuctionHouse.getInstance().getServer().getPluginManager().callEvent(auctionEndEvent);
if (auctionEndEvent.isCancelled()) continue;
@ -154,26 +152,26 @@ public class TickAuctionsTask extends BukkitRunnable {
// alert seller and buyer
if (Bukkit.getOfflinePlayer(auctionItem.getOwner()).isOnline()) {
instance.getLocale().getMessage("auction.itemsold")
AuctionHouse.getInstance().getLocale().getMessage("auction.itemsold")
.processPlaceholder("item", AuctionAPI.getInstance().getItemName(itemStack))
.processPlaceholder("amount", itemStack.clone().getAmount())
.processPlaceholder("price", AuctionAPI.getInstance().formatNumber(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice : finalPrice - tax))
.processPlaceholder("buyer_name", Bukkit.getOfflinePlayer(auctionItem.getHighestBidder()).getName())
.processPlaceholder("buyer_displayname", AuctionAPI.getInstance().getDisplayName(Bukkit.getOfflinePlayer(auctionItem.getHighestBidder())))
.sendPrefixedMessage(Bukkit.getOfflinePlayer(auctionItem.getOwner()).getPlayer());
instance.getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(Bukkit.getOfflinePlayer(auctionItem.getOwner())))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice : finalPrice - tax)).sendPrefixedMessage(Bukkit.getOfflinePlayer(auctionItem.getOwner()).getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(Bukkit.getOfflinePlayer(auctionItem.getOwner())))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice : finalPrice - tax)).sendPrefixedMessage(Bukkit.getOfflinePlayer(auctionItem.getOwner()).getPlayer());
}
if (auctionWinner.isOnline()) {
assert auctionWinner.getPlayer() != null;
instance.getLocale().getMessage("auction.bidwon")
AuctionHouse.getInstance().getLocale().getMessage("auction.bidwon")
.processPlaceholder("item", AuctionAPI.getInstance().getItemName(itemStack))
.processPlaceholder("amount", itemStack.getAmount())
.processPlaceholder("price", AuctionAPI.getInstance().formatNumber(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice + tax : finalPrice))
.sendPrefixedMessage(auctionWinner.getPlayer());
if (!Settings.BIDDING_TAKES_MONEY.getBoolean())
instance.getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(auctionWinner.getPlayer()))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice + tax : finalPrice)).sendPrefixedMessage(auctionWinner.getPlayer());
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyremove").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(AuctionHouse.getCurrencyManager().getBalance(auctionWinner.getPlayer()))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice + tax : finalPrice)).sendPrefixedMessage(auctionWinner.getPlayer());
// remove the dupe tracking
NBT.modify(itemStack, nbt -> {
@ -189,7 +187,7 @@ public class TickAuctionsTask extends BukkitRunnable {
else
PlayerUtils.giveItem(auctionWinner.getPlayer(), itemStack);
instance.getAuctionItemManager().sendToGarbage(auctionItem);
AuctionHouse.getAuctionItemManager().sendToGarbage(auctionItem);
continue;
}
} else {
@ -198,7 +196,7 @@ public class TickAuctionsTask extends BukkitRunnable {
else
PlayerUtils.giveItem(auctionWinner.getPlayer(), itemStack);
instance.getAuctionItemManager().sendToGarbage(auctionItem);
AuctionHouse.getAuctionItemManager().sendToGarbage(auctionItem);
continue;
}
}