🪜 skip select listing type config option, closes #45

Took 5 minutes

Took 38 seconds
This commit is contained in:
Kiran Hart 2023-03-24 15:34:17 -04:00
parent f44a855e0b
commit 14af0816e4
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
4 changed files with 70 additions and 10 deletions

View File

@ -19,6 +19,7 @@
package ca.tweetzy.auctionhouse.commands;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.ahv3.api.ListingType;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
@ -29,9 +30,9 @@ import ca.tweetzy.auctionhouse.guis.sell.GUISellPlaceItem;
import ca.tweetzy.auctionhouse.helpers.PlayerHelper;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.commands.AbstractCommand;
import ca.tweetzy.flight.comp.enums.CompMaterial;
import ca.tweetzy.core.utils.PlayerUtils;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.flight.comp.enums.CompMaterial;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
@ -135,9 +136,28 @@ public class CommandAdmin extends AbstractCommand {
instance.getLocale().getMessage("general.air").sendPrefixedMessage(player);
return ReturnType.FAILURE;
} else {
instance.getGuiManager().showGUI(player, new GUISellListingType(instance.getAuctionPlayerManager().getPlayer(player.getUniqueId()), selected -> {
instance.getGuiManager().showGUI(player, new GUISellPlaceItem(instance.getAuctionPlayerManager().getPlayer(player.getUniqueId()), GUISellPlaceItem.ViewMode.SINGLE_ITEM, selected));
}));
final AuctionPlayer auctionPlayer = instance.getAuctionPlayerManager().getPlayer(player.getUniqueId());
if (Settings.SELL_MENU_SKIPS_TYPE_SELECTION.getBoolean()) {
if (Settings.FORCE_AUCTION_USAGE.getBoolean()) {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellPlaceItem(auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, ListingType.AUCTION));
return ReturnType.SUCCESS;
}
if (!Settings.ALLOW_USAGE_OF_BID_SYSTEM.getBoolean()) {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellPlaceItem(auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, ListingType.BIN));
return ReturnType.SUCCESS;
}
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellListingType(auctionPlayer, selected -> {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellPlaceItem(auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, selected));
}));
} else {
instance.getGuiManager().showGUI(player, new GUISellListingType(auctionPlayer, selected -> {
instance.getGuiManager().showGUI(player, new GUISellPlaceItem(auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, selected));
}));
}
}
break;
case "open":

View File

@ -20,6 +20,7 @@ package ca.tweetzy.auctionhouse.commands;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.ahv3.api.ListingResult;
import ca.tweetzy.auctionhouse.ahv3.api.ListingType;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
@ -95,9 +96,28 @@ public final class CommandSell extends AbstractCommand {
instance.getLocale().getMessage("general.air").sendPrefixedMessage(player);
return ReturnType.FAILURE;
} else {
instance.getGuiManager().showGUI(player, new GUISellListingType(auctionPlayer, selected -> {
instance.getGuiManager().showGUI(player, new GUISellPlaceItem(auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, selected));
}));
if (Settings.SELL_MENU_SKIPS_TYPE_SELECTION.getBoolean()) {
if (Settings.FORCE_AUCTION_USAGE.getBoolean()) {
instance.getGuiManager().showGUI(player, new GUISellPlaceItem(auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, ListingType.AUCTION));
return ReturnType.SUCCESS;
}
if (!Settings.ALLOW_USAGE_OF_BID_SYSTEM.getBoolean()) {
instance.getGuiManager().showGUI(player, new GUISellPlaceItem(auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, ListingType.BIN));
return ReturnType.SUCCESS;
}
instance.getGuiManager().showGUI(player, new GUISellListingType(auctionPlayer, selected -> {
instance.getGuiManager().showGUI(player, new GUISellPlaceItem(auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, selected));
}));
} else {
instance.getGuiManager().showGUI(player, new GUISellListingType(auctionPlayer, selected -> {
instance.getGuiManager().showGUI(player, new GUISellPlaceItem(auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, selected));
}));
}
}
return ReturnType.SUCCESS;
}

View File

@ -19,6 +19,7 @@
package ca.tweetzy.auctionhouse.guis;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.ahv3.api.ListingType;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.api.events.AuctionBidEvent;
import ca.tweetzy.auctionhouse.api.hook.FloodGateHook;
@ -546,9 +547,27 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui {
return;
}
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellListingType(this.auctionPlayer, selected -> {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellPlaceItem(this.auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, selected));
}));
if (Settings.SELL_MENU_SKIPS_TYPE_SELECTION.getBoolean()) {
if (Settings.FORCE_AUCTION_USAGE.getBoolean()) {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellPlaceItem(auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, ListingType.AUCTION));
return;
}
if (!Settings.ALLOW_USAGE_OF_BID_SYSTEM.getBoolean()) {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellPlaceItem(auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, ListingType.BIN));
return;
}
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellListingType(this.auctionPlayer, selected -> {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellPlaceItem(this.auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, selected));
}));
} else {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellListingType(this.auctionPlayer, selected -> {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUISellPlaceItem(this.auctionPlayer, GUISellPlaceItem.ViewMode.SINGLE_ITEM, selected));
}));
}
});
}
} else {

View File

@ -56,6 +56,7 @@ public class Settings {
public static final ConfigSetting STORE_PAYMENTS_FOR_MANUAL_COLLECTION = new ConfigSetting(config, "auction setting.store payments for manual collection", false, "If true, auction house will store the payments to be manually collected rather than automatically given to the player");
public static final ConfigSetting ALLOW_REPEAT_BIDS = new ConfigSetting(config, "auction setting.allow repeated bids", true, "If true, the highest bidder on an item can keep placing bids to raise their initial bid.");
public static final ConfigSetting COLLECTION_BIN_ITEM_LIMIT = new ConfigSetting(config, "auction setting.collection bin item limit", 45, "How many items can be stored in the collection bin. If this is reached the player cannot list anymore items, regardless of active listings");
public static final ConfigSetting SELL_MENU_SKIPS_TYPE_SELECTION = new ConfigSetting(config, "auction setting.skip type selection for sell menu", false, "If true the sell menu process will skip asking for the listing type depending on your auction settings (ie. bin only or auction only)");
public static final ConfigSetting BUNDLE_LIST_LIMIT = new ConfigSetting(config, "auction setting.bundle listing limit.listing limit", 45, "How many bundled listings can a player sell at any given time");
public static final ConfigSetting BUNDLE_LIST_LIMIT_INCLUDE_COLLECTION_BIN = new ConfigSetting(config, "auction setting.bundle listing limit.include collection bin", false, "If true, collection bin bundles will also count towards this limit");