mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-26 06:05:25 +01:00
fixed issues with confirmation gui, and NaN value being entered
Took 5 minutes
This commit is contained in:
parent
d5e4a3dc51
commit
38c053fc30
@ -45,6 +45,7 @@ public class CommandAuctionHouse extends AbstractCommand {
|
||||
}
|
||||
|
||||
if (args.length == 1 && AuctionHouse.getInstance().getCommandManager().getSubCommands("auctionhouse").stream().noneMatch(cmd -> cmd.equalsIgnoreCase(StringUtils.join(args, ' ').trim()))) {
|
||||
if (args[0].equalsIgnoreCase("NaN")) return ReturnType.FAILURE;
|
||||
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIAuctionHouse(AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(player.getUniqueId()), StringUtils.join(args, ' ').trim()));
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ public final class CommandSell extends AbstractCommand {
|
||||
boolean partialBuy = false;
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (NumberUtils.isDouble(args[i])) {
|
||||
if (NumberUtils.isDouble(args[i]) && !Double.isNaN(Double.parseDouble(args[i]))) {
|
||||
if (buyNowPrice == null)
|
||||
buyNowPrice = Double.parseDouble(args[i]);
|
||||
else if (startingBid == null)
|
||||
|
@ -3,7 +3,9 @@ package ca.tweetzy.auctionhouse.guis.confirmation;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.compatibility.CompatibleHand;
|
||||
import ca.tweetzy.core.gui.Gui;
|
||||
import ca.tweetzy.core.utils.PlayerUtils;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.core.utils.items.TItemBuilder;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -47,6 +49,9 @@ public class GUIConfirmListing extends AbstractPlaceholderGui {
|
||||
this.requiresHandRemove = requiresHandRemove;
|
||||
this.isInfinite = isInfinite;
|
||||
|
||||
setOnOpen(open -> PlayerUtils.takeActiveItem(open.player, CompatibleHand.MAIN_HAND, originalItem.getAmount()));
|
||||
setOnClose(close -> close.player.getInventory().addItem(originalItem));
|
||||
|
||||
setTitle(TextUtils.formatText(Settings.GUI_CONFIRM_LISTING_TITLE.getString()));
|
||||
setAcceptsItems(false);
|
||||
setRows(1);
|
||||
@ -63,7 +68,8 @@ public class GUIConfirmListing extends AbstractPlaceholderGui {
|
||||
setItems(5, 8, new TItemBuilder(Objects.requireNonNull(Settings.GUI_CONFIRM_LISTING_NO_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_CONFIRM_LISTING_NO_NAME.getString()).setLore(Settings.GUI_CONFIRM_LISTING_NO_LORE.getStringList()).toItemStack());
|
||||
|
||||
setActionForRange(5, 8, ClickType.LEFT, e -> {
|
||||
e.gui.close();
|
||||
e.gui.exit();
|
||||
e.player.getInventory().addItem(originalItem);
|
||||
});
|
||||
|
||||
setActionForRange(0, 3, ClickType.LEFT, e -> {
|
||||
@ -82,7 +88,7 @@ public class GUIConfirmListing extends AbstractPlaceholderGui {
|
||||
this.isInfinite,
|
||||
false
|
||||
);
|
||||
e.gui.close();
|
||||
e.gui.exit();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user