mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-01-08 12:57:35 +01:00
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:
parent
46a8856245
commit
05138dc6cc
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user