mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-25 05:55:13 +01:00
adjust order for dealing with confirm listing death return
Took 13 minutes
This commit is contained in:
parent
b40f1068d3
commit
f4f1c942b0
@ -26,6 +26,7 @@ import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.utils.PlayerUtils;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.flight.comp.enums.CompMaterial;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
@ -59,7 +60,6 @@ public final class GUIListingConfirm extends AbstractPlaceholderGui {
|
||||
});
|
||||
|
||||
setOnClose(close -> {
|
||||
close.player.removeMetadata("AuctionHouseConfirmListing", AuctionHouse.getInstance());
|
||||
final AuctionPlayer auctionPlayer = AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(close.player.getUniqueId());
|
||||
|
||||
if (auctionPlayer.getItemBeingListed() != null) {
|
||||
@ -67,6 +67,7 @@ public final class GUIListingConfirm extends AbstractPlaceholderGui {
|
||||
auctionPlayer.setItemBeingListed(null);
|
||||
}
|
||||
|
||||
close.player.removeMetadata("AuctionHouseConfirmListing", AuctionHouse.getInstance());
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().processSell(close.player);
|
||||
});
|
||||
|
||||
@ -85,8 +86,13 @@ public final class GUIListingConfirm extends AbstractPlaceholderGui {
|
||||
resulted.add(e.player.getUniqueId());
|
||||
|
||||
setAllowClose(true);
|
||||
final AuctionPlayer auctionPlayer = AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(e.player.getUniqueId());
|
||||
auctionPlayer.setItemBeingListed(CompMaterial.AIR.parseItem());
|
||||
|
||||
this.result.accept(false);
|
||||
});
|
||||
|
||||
|
||||
setActionForRange(0, 3, ClickType.LEFT, e -> {
|
||||
if (resulted.contains(e.player.getUniqueId())) return;
|
||||
resulted.add(e.player.getUniqueId());
|
||||
|
@ -71,8 +71,11 @@ public class PlayerListeners implements Listener {
|
||||
Bukkit.getServer().getScheduler().cancelTask(auctionPlayer.getAssignedTaskId());
|
||||
|
||||
if (auctionPlayer.getItemBeingListed() != null && player.getLocation().getWorld() != null) {
|
||||
if (!AuctionHouse.getInstance().getAuctionPlayerManager().isInSellProcess(player))
|
||||
player.getLocation().getWorld().dropItemNaturally(player.getLocation(), auctionPlayer.getItemBeingListed());
|
||||
if (!AuctionHouse.getInstance().getAuctionPlayerManager().isInSellProcess(player)) {
|
||||
|
||||
if (!player.hasMetadata("AuctionHouseConfirmListing"))
|
||||
player.getLocation().getWorld().dropItemNaturally(player.getLocation(), auctionPlayer.getItemBeingListed());
|
||||
}
|
||||
auctionPlayer.setItemBeingListed(CompMaterial.AIR.parseItem());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user