[SPIGOT-5768] Fire a cancelable event when an item is destroyed due to falling in the void. Created: 07/Jun/20 Updated: 21/Feb/24 Resolved: 21/Feb/24 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor |
| Reporter: | Ryan Hamshire | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Version: | git-Spigot-a99063f-fad2494 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT) |
| Guidelines Read: | Yes |
| Description |
|
When an item falls into the void, as in The End for example. I tried to catch this by checking EntityDamageEvent for void damage, and also ItemDespawnEvent. Seems neither fires for this case. Was hoping to cancel that event and send the item elsewhere. Mostly interested in itemstacks, but projectiles would also be nice (for returning lost tridents and ender pearls). |
| Comments |
| Comment by Marcel S [ 25/Jun/20 ] |
|
The Item interface does not extend LivingEntity whereby it's not even able to obtain any damage. A solution would be to listen to the https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDeathEvent.html event and to respawn the item somewhere else |