Skip to content

Conversation

@Scralar
Copy link
Contributor

@Scralar Scralar commented Oct 17, 2025

What this does

Added a minimum hearts threshold system that prevents players from dropping or giving heart items when they die if they have below a certain number of hearts. Players still lose hearts from their max health, but no heart items are spawned.

New stuff

  • Config option: minHeartsToSpawnHeartItem - controls minimum hearts required to spawn heart items
  • Event properties: heartSpawningBlocked in death events for plugin integration
  • Comprehensive coverage - applies to all heart dropping mechanisms (PvP, natural, cooldown, max hearts)
  • Backward compatible - disabled by default (set to 0)

How it works

When a player dies with hearts below the threshold:

  • They still lose hearts from their max health
  • No heart items are dropped on the ground
  • Killer doesn't receive heart items from them
  • Works for both PvP and natural deaths
  • Applies to all heart dropping scenarios (cooldown, max hearts, etc.)

Files changed

  • Added minHeartsToSpawnHeartItem config option with documentation
  • Added canSpawnHeartItem() utility method in PlayerDeathListener
  • Updated handlePvPDeath() and handleNaturalDeath() to check threshold
  • Fixed cooldown and max hearts drop logic to respect threshold
  • Added heartSpawningBlocked property to death events
  • Updated README with new config option

Testing

Built and compiled fine, follows existing code patterns. All heart dropping mechanisms now respect the threshold.

Notes

  • Default value is 0 (disabled) to maintain backward compatibility
  • Players below threshold still lose hearts but don't spawn items
  • No breaking changes
  • README and config documentation updated

- Add minHeartsToSpawnHeartItem config option to control when players can drop/give hearts
- Players below threshold still lose hearts but won't spawn heart items
- Add heartSpawningBlocked property to death events for plugin integration
- Apply threshold to all heart dropping mechanisms (PvP, natural, cooldown, max hearts)
- Update README and config documentation
- Default value is 0 (disabled) to maintain backward compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant