From 61ae708abfc892fa391b941e2f3dd798b62e9df0 Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Fri, 23 Apr 2021 18:24:53 -0400 Subject: [PATCH] added option to disable usage of the bid system, added option to let admin removed items go back to the original owner. --- pom.xml | 7 ++++++- .../ca/tweetzy/auctionhouse/commands/CommandSell.java | 2 ++ .../ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java | 9 +++++---- .../java/ca/tweetzy/auctionhouse/settings/Settings.java | 2 ++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index b0e2ee4..8c2265b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ca.tweetzy auctionhouse - 2.3.0 + 2.4.0 UTF-8 @@ -145,5 +145,10 @@ maven-deploy-plugin 2.8.2 + + com.zaxxer + HikariCP + 3.2.0 + \ No newline at end of file diff --git a/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java b/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java index 0ec9555..9928f57 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java +++ b/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java @@ -129,6 +129,8 @@ public class CommandSell extends AbstractCommand { SoundManager.getInstance().playSound(player, Settings.SOUNDS_LISTED_ITEM_ON_AUCTION_HOUSE.getString(), 1.0F, 1.0F); } else { + // check if the bid system is available to players + if (!Settings.ALLOW_USAGE_OF_BID_SYSTEM.getBoolean()) return ReturnType.FAILURE; // they want to use the bidding system, so make it a bid item if (args.length != 3) return ReturnType.SYNTAX_ERROR; diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java index 3a5b664..b7b8e84 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java @@ -8,13 +8,11 @@ import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper; import ca.tweetzy.auctionhouse.managers.SoundManager; import ca.tweetzy.auctionhouse.settings.Settings; import ca.tweetzy.core.compatibility.ServerVersion; -import ca.tweetzy.core.compatibility.XMaterial; import ca.tweetzy.core.gui.Gui; import ca.tweetzy.core.utils.TextUtils; import ca.tweetzy.core.utils.items.TItemBuilder; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.block.BlockState; import org.bukkit.block.ShulkerBox; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BlockStateMeta; @@ -150,7 +148,6 @@ public class GUIAuctionHouse extends Gui { // Items int slot = 0; List data = this.items.stream().sorted(Comparator.comparingInt(AuctionItem::getRemainingTime).reversed()).skip((page - 1) * 45L).limit(45).collect(Collectors.toList()); - for (AuctionItem auctionItem : data) { setButton(slot++, auctionItem.getDisplayStack(AuctionStackType.MAIN_AUCTION_HOUSE), e -> { switch (e.clickType) { @@ -189,7 +186,11 @@ public class GUIAuctionHouse extends Gui { break; case MIDDLE: if (e.player.isOp() || e.player.hasPermission("auctionhouse.admin")) { - AuctionHouse.getInstance().getAuctionItemManager().removeItem(auctionItem.getKey()); + if (Settings.SEND_REMOVED_ITEM_BACK_TO_PLAYER.getBoolean()) { + AuctionHouse.getInstance().getAuctionItemManager().getItem(auctionItem.getKey()).setExpired(true); + } else { + AuctionHouse.getInstance().getAuctionItemManager().removeItem(auctionItem.getKey()); + } killTask(); e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer)); } diff --git a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java index a487583..9fbf333 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java +++ b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java @@ -43,6 +43,8 @@ public class Settings { public static final ConfigSetting BROADCAST_AUCTION_LIST = new ConfigSetting(config, "auction setting.broadcast auction list", false, "Should the entire server be alerted when a player lists an item?"); public static final ConfigSetting PLAYER_NEEDS_TOTAL_PRICE_TO_BID = new ConfigSetting(config, "auction setting.bidder must have funds in account", false, "Should the player who is placing a bid on an item have the money in their account to cover the cost?"); public static final ConfigSetting USE_ASYNC_GUI_REFRESH = new ConfigSetting(config, "auction setting.use async gui refresh", false, "Should the gui refresh be done using asynchronous tasks?", "This may reduce lag that can be caused, but", "items may have a flickering effect inside the gui."); + public static final ConfigSetting SEND_REMOVED_ITEM_BACK_TO_PLAYER = new ConfigSetting(config, "auction setting.send removed item back to player", true, "Should items removed by staff from the auction house be sent back to the player?"); + public static final ConfigSetting ALLOW_USAGE_OF_BID_SYSTEM = new ConfigSetting(config, "auction setting.allow bid system usage", true, "Should players be allowed to use the bid option cmd params?"); public static final ConfigSetting AUTO_SAVE_ENABLED = new ConfigSetting(config, "auction setting.auto save.enabled", true, "Should the auto save task be enabled?"); public static final ConfigSetting AUTO_SAVE_EVERY = new ConfigSetting(config, "auction setting.auto save.time", 900, "How often should the auto save active? (in seconds. Ex. 900 = 15min)");