mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-22 05:25:11 +01:00
⌚ Add slight delay to auction creation
Took 7 minutes
This commit is contained in:
parent
0d441601ac
commit
e3a41dd64c
@ -338,9 +338,9 @@ public final class CommandSell extends AbstractCommand {
|
||||
auctionedItem.setInfinite(isInfinite);
|
||||
auctionedItem.setAllowPartialBuy(partialBuy);
|
||||
|
||||
player.getInventory().setItemInHand(CompMaterial.AIR.parseItem());
|
||||
|
||||
if (Settings.ASK_FOR_LISTING_CONFIRMATION.getBoolean()) {
|
||||
player.getInventory().setItemInHand(CompMaterial.AIR.parseItem());
|
||||
|
||||
instance.getGuiManager().showGUI(player, new GUIListingConfirm(player, auctionedItem, result -> {
|
||||
if (!result) {
|
||||
player.closeInventory();
|
||||
@ -349,9 +349,36 @@ public final class CommandSell extends AbstractCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(AuctionHouse.getInstance(), () -> {
|
||||
if (auctionPlayer.getPlayer() == null || !auctionPlayer.getPlayer().isOnline()) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.getInventory().setItemInHand(CompMaterial.AIR.parseItem());
|
||||
|
||||
AuctionCreator.create(auctionPlayer, auctionedItem, (auction, listingResult) -> {
|
||||
if (listingResult != ListingResult.SUCCESS) {
|
||||
PlayerUtils.giveItem(player, auction.getItem());
|
||||
auctionPlayer.setItemBeingListed(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean())
|
||||
instance.getGuiManager().showGUI(player, new GUIAuctionHouse(auctionPlayer));
|
||||
});
|
||||
|
||||
}, Settings.INTERNAL_CREATE_DELAY.getInt());
|
||||
}));
|
||||
} else {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(AuctionHouse.getInstance(), () -> {
|
||||
if (auctionPlayer.getPlayer() == null || !auctionPlayer.getPlayer().isOnline()) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.getInventory().setItemInHand(CompMaterial.AIR.parseItem());
|
||||
|
||||
AuctionCreator.create(auctionPlayer, auctionedItem, (auction, listingResult) -> {
|
||||
if (listingResult != ListingResult.SUCCESS) {
|
||||
player.closeInventory();
|
||||
PlayerUtils.giveItem(player, auction.getItem());
|
||||
auctionPlayer.setItemBeingListed(null);
|
||||
return;
|
||||
@ -360,18 +387,9 @@ public final class CommandSell extends AbstractCommand {
|
||||
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean())
|
||||
instance.getGuiManager().showGUI(player, new GUIAuctionHouse(auctionPlayer));
|
||||
});
|
||||
}));
|
||||
} else {
|
||||
AuctionCreator.create(auctionPlayer, auctionedItem, (auction, listingResult) -> {
|
||||
if (listingResult != ListingResult.SUCCESS) {
|
||||
PlayerUtils.giveItem(player, auction.getItem());
|
||||
auctionPlayer.setItemBeingListed(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean())
|
||||
instance.getGuiManager().showGUI(player, new GUIAuctionHouse(auctionPlayer));
|
||||
});
|
||||
}, Settings.INTERNAL_CREATE_DELAY.getInt());
|
||||
|
||||
}
|
||||
|
||||
return ReturnType.SUCCESS;
|
||||
|
26
src/main/java/ca/tweetzy/auctionhouse/helpers/Validate.java
Normal file
26
src/main/java/ca/tweetzy/auctionhouse/helpers/Validate.java
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Auction House
|
||||
* Copyright 2023 Kiran Hart
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package ca.tweetzy.auctionhouse.helpers;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@UtilityClass
|
||||
public final class Validate {
|
||||
|
||||
}
|
@ -101,6 +101,7 @@ public class PlayerListeners implements Listener {
|
||||
|
||||
player.getInventory().addItem(instance.getAuctionPlayerManager().getPlayer(player.getUniqueId()).getItemBeingListed());
|
||||
instance.getAuctionPlayerManager().getPlayer(player.getUniqueId()).setItemBeingListed(null);
|
||||
instance.getAuctionPlayerManager().getPlayer(player.getUniqueId()).setPlayer(null);
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,6 +54,7 @@ public class Settings {
|
||||
* ===============================*/
|
||||
public static final ConfigSetting DEFAULT_BIN_LISTING_TIME = new ConfigSetting(config, "auction setting.listings times.bin item", 86400, "The default listing time for bin items (buy only items) before they expire");
|
||||
public static final ConfigSetting DEFAULT_AUCTION_LISTING_TIME = new ConfigSetting(config, "auction setting.listings times.auction item", 604800, "The default listing time for auction items before they expire");
|
||||
public static final ConfigSetting INTERNAL_CREATE_DELAY = new ConfigSetting(config, "auction setting.internal create delay", 3, "How many ticks should auction house wait before actually creating the item.");
|
||||
public static final ConfigSetting MAX_AUCTION_PRICE = new ConfigSetting(config, "auction setting.pricing.max auction price", 1000000000, "The max price for buy only / buy now items");
|
||||
public static final ConfigSetting MAX_AUCTION_START_PRICE = new ConfigSetting(config, "auction setting.pricing.max auction start price", 1000000000, "The max price starting a bidding auction");
|
||||
public static final ConfigSetting MAX_AUCTION_INCREMENT_PRICE = new ConfigSetting(config, "auction setting.pricing.max auction increment price", 1000000000, "The max amount for incrementing a bid.");
|
||||
|
Loading…
Reference in New Issue
Block a user