fix player "crash" and leave, to use new listing item (give item back if they leave or crash), same with death

Took 45 seconds
This commit is contained in:
Kiran Hart 2022-11-18 10:45:48 -05:00
parent 46a8856245
commit 05138dc6cc
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3

View File

@ -49,7 +49,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.persistence.PersistentDataType;
@ -96,6 +95,12 @@ public class PlayerListeners implements Listener {
public void onPlayerQuit(PlayerQuitEvent e) {
final Player player = e.getPlayer();
final AuctionHouse instance = AuctionHouse.getInstance();
if (instance.getAuctionPlayerManager().getPlayer(player.getUniqueId()) != null)
if (instance.getAuctionPlayerManager().getPlayer(player.getUniqueId()).getItemBeingListed() != null)
player.getInventory().addItem(instance.getAuctionPlayerManager().getPlayer(player.getUniqueId()).getItemBeingListed());
instance.getAuctionPlayerManager().getSellHolding().remove(player.getUniqueId());
instance.getLogger().info("Removing sell holding instance for user: " + player.getName());
}