[SPIGOT-1027] Clearing inventory on PlayerQuitEvent causes Issue Created: 07/Jul/15  Updated: 12/Jul/15  Resolved: 12/Jul/15

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Zack Pollard Assignee: Unassigned
Resolution: Duplicate Votes: 1
Labels: inventory, spigot
Environment:

This server is running CraftBukkit version git-Spigot-f928e7a-e91aed8 (MC: 1.8.7) (Implementing API version 1.8.7-R0.1-SNAPSHOT)


Issue Links:
Duplicate

 Description   

When you do event.getPlayer().getInventory().clear() when a player disconnects from the server, when they re-join their inventory is cleared but if they had an item such as a diamond sword in their hand when they reconnect, they will still have the attack damage of that sword but on their fist.



 Comments   
Comment by Zack Pollard [ 10/Jul/15 ]

I have a feeling it's an issue with the server caching attributes of some sort and those not being cleaned up properly due to the player object being in a strange state at these times, unsure though as I haven't been able to delve into the spigot or nms code behind it as of yet.

Comment by Connor Harries [ 10/Jul/15 ]

Anyone have any information on this? Having issue using similar code.

Comment by Zack Pollard [ 07/Jul/15 ]

This is the code that is producing this issue https://gist.github.com/zackpollard/6c3c8657fba1f1b489b7, the restore method is ran on PlayerQuitEvent, after trying to avoid this issue, I found that the same code running on PlayerJoinEvent has the same issue. The same code ran when the player is online however does not reproduce this issue.

Generated at Tue Apr 22 04:30:17 UTC 2025 using Jira 10.3.5#10030005-sha1:190c783f2bd6c69cd5accdb70f97e48812a78d14.