🩹 patch for meteor client no packet close (death+confirm menu)

Took 4 minutes
This commit is contained in:
Kiran Hart 2023-02-20 16:27:24 -05:00
parent 9d0f490881
commit 8b7084623f
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3

View File

@ -18,6 +18,7 @@
package ca.tweetzy.auctionhouse.guis.confirmation;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.AuctionStackType;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
@ -25,6 +26,7 @@ import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.utils.TextUtils;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.metadata.FixedMetadataValue;
import java.util.HashSet;
import java.util.Set;
@ -45,6 +47,17 @@ public final class GUIListingConfirm extends AbstractPlaceholderGui {
super.setTitle(TextUtils.formatText(Settings.GUI_CONFIRM_LISTING_TITLE.getString()));
setAcceptsItems(false);
setAllowClose(false);
setOnOpen(open -> {
if (open.player.hasMetadata("AuctionHouseConfirmListing")) {
open.gui.close();
return;
}
open.player.setMetadata("AuctionHouseConfirmListing", new FixedMetadataValue(AuctionHouse.getInstance(), "ConfirmListing"));
});
setOnClose(close -> close.player.removeMetadata("AuctionHouseConfirmListing", AuctionHouse.getInstance()));
setRows(1);
draw();
}