added option to disable usage of the bid system, added option to let admin removed items go back to the original owner.

This commit is contained in:
Kiran Hart 2021-04-23 18:24:53 -04:00
parent 9761dd6eab
commit 61ae708abf
4 changed files with 15 additions and 5 deletions

View File

@ -6,7 +6,7 @@
<groupId>ca.tweetzy</groupId>
<artifactId>auctionhouse</artifactId>
<version>2.3.0</version>
<version>2.4.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -145,5 +145,10 @@
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.2.0</version>
</dependency>
</dependencies>
</project>

View File

@ -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;

View File

@ -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<AuctionItem> 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));
}

View File

@ -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)");