force close inv if open listing menu after list / confirm is off

Took 16 minutes
This commit is contained in:
Kiran Hart 2023-02-17 07:35:32 -05:00
parent 8534fed83b
commit 4cd6bc7ea5
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
4 changed files with 13 additions and 1 deletions

View File

@ -46,7 +46,6 @@ import ca.tweetzy.core.gui.events.GuiClickEvent;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.core.utils.NumberUtils;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.core.utils.items.TItemBuilder;
import ca.tweetzy.core.utils.nms.NBTEditor;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -79,6 +78,10 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui {
public GUIAuctionHouse(AuctionPlayer auctionPlayer) {
super(auctionPlayer);
this.auctionPlayer = auctionPlayer;
if (!Bukkit.getOfflinePlayer(this.auctionPlayer.getUuid()).isOnline())
return;
setTitle(TextUtils.formatText(Settings.GUI_AUCTION_HOUSE_TITLE.getString()));
setRows(6);
setAcceptsItems(false);

View File

@ -146,6 +146,8 @@ public final class GUIBundleCreation extends AbstractPlaceholderGui {
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean())
instance.getGuiManager().showGUI(auctionPlayer.getPlayer(), new GUIAuctionHouse(auctionPlayer));
else
AuctionHouse.newChain().sync(player::closeInventory).execute();
});
}));
} else {
@ -159,6 +161,8 @@ public final class GUIBundleCreation extends AbstractPlaceholderGui {
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean())
instance.getGuiManager().showGUI(auctionPlayer.getPlayer(), new GUIAuctionHouse(auctionPlayer));
else
AuctionHouse.newChain().sync(player::closeInventory).execute();
});
}
});

View File

@ -345,6 +345,8 @@ public final class GUISellAuction extends AbstractPlaceholderGui {
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean())
click.manager.showGUI(click.player, new GUIAuctionHouse(this.auctionPlayer));
else
AuctionHouse.newChain().sync(click.player::closeInventory).execute();
});
}

View File

@ -209,6 +209,7 @@ public final class GUISellBin extends AbstractPlaceholderGui {
}
private void performAuctionListing(GuiClickEvent click) {
AuctionCreator.create(this.auctionPlayer, createListingItem(), (originalListing, listingResult) -> {
if (listingResult != ListingResult.SUCCESS) {
click.player.closeInventory();
@ -219,6 +220,8 @@ public final class GUISellBin extends AbstractPlaceholderGui {
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean())
click.manager.showGUI(click.player, new GUIAuctionHouse(this.auctionPlayer));
else
AuctionHouse.newChain().sync(click.player::closeInventory).execute();
});
}