Add event to account for items being ejected from item frames
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Is your feature request related to a problem?
The PlayerItemFrameChangeEvent is scoped to player-related triggers only, and there is no general ItemFrameChangeEvent encompassing the other triggers for why an item frame's state might change.
Describe the solution you'd like.
I am curious if Paper would see value in a PR adding some kind of ItemFrameEjectItemEvent, which, unlike PlayerItemFrameChangeEvent, would listen for any item frame ejection, regardless of the entity that caused it.
Or, alternatively, some kind of general ItemFrameChangeEvent which would deprecate PlayerItemFrameChangeEvent, but this may be difficult as I don't see a clean way to handle the consequence of ItemFrameChangeAction's PLACE and ROTATE enumerators being unused in the case of all other entities (in other words, it is not possible afaik for any other entity to have any value for ItemFrameChangeAction that is not REMOVE).
I can think of a few different implementations. Perhaps, similar to HangingBreakEvent, there could be a RemoveCause enum, but I can only think of a few causes:
- item frame broke (whether this event should be triggered in that case might be something to discuss)
- player removed an item
- projectile (e.g. skeleton shooting an item out of the item frame)
- explosion (e.g. creeper explodes just far enough as to eject the item but not destroy the item frame itself, is this even possible?)
Open to hearing any other possible causes.
Another implementation might be just to skip the enum and directly provide the entity who triggered the item ejection. This would be under the assumption that item frame ejections can only be caused by entities (perhaps it could be a nullable entity, indicating that the item frame itself was what broke?).
I don't have too much experience working with the Paper API, and this would be my first time contributing to Paper, so let me know if this is something Paper is open to and/or if there are any considerations to be made first.
Describe alternatives you've considered.
I suppose these could be handled case by case, e.g. use an EntityByEntityDamageEvent to check if the damager is a projectile and the damagee is an item frame.
Other
Thanks for your time!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked PlayerItemFrameChangeEvent and HangingBreakEvent API documentation, then compare the proposed event shapes and possible causes described in the issue. Resolve whether the scope should be an ejection-specific event or a general item-frame change event; done means an agreed API design with clearly defined causes and behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100