SPIGOT-7806: Handle both loot and inventory item drop behaviour in PlayerDeathEvent

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot
2024-07-06 17:25:39 +10:00
parent b6655d093f
commit d7c74a442e
3 changed files with 89 additions and 62 deletions

View File

@@ -924,7 +924,13 @@ public class CraftEventFactory {
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
if (stack == null || stack.getType() == Material.AIR) continue;
victim.drop(CraftItemStack.asNMSCopy(stack), true, false, false); // SPIGOT-7800, SPIGOT-7801: Vanilla Behaviour for dropped items
if (stack instanceof CraftItemStack craftItemStack && craftItemStack.isForInventoryDrop()) {
victim.drop(CraftItemStack.asNMSCopy(stack), true, false, false); // SPIGOT-7800, SPIGOT-7801: Vanilla Behaviour for Player Inventory dropped items
} else {
victim.forceDrops = true;
victim.spawnAtLocation(CraftItemStack.asNMSCopy(stack)); // SPIGOT-7806: Vanilla Behaviour for items not related to Player Inventory dropped items
victim.forceDrops = false;
}
}
return event;