Implemented EntityDamageDoorEvent
EntityDamageDoorEvent: Handle Door Damage Interactions
Description
I've introduced a new event called EntityDamageDoorEvent in the PaperMC server software. This event is triggered when an entity (currently limited to Zombies and Pillagers by default) damages a door. It provides essential information about the damaged door, the break time, and the total door break time.
This implementation takes into account differences in breaking time between zombies (240 ticks) and pillagers (60 ticks).
Event Details
-
Event Name:
EntityDamageDoorEvent - Trigger: When an entity damages a door
- Purpose: To allow developers to handle door damage interactions
Key Components
- Entity: The damaging entity (e.g., Zombie, Pillager).
- Door: The door being damaged.
- Break Time: The ticks spent breaking the door.
- Door Break Time: The total ticks required to break the door.
Usage Example
@EventHandler
public void onEntityDamageDoor(EntityDamageDoorEvent event) {
Entity damagingEntity = event.getEntity();
Door damagedDoor = event.getDamagedDoor();
int breakTime = event.getBreakTime();
int totalBreakTime = event.getDoorBreakTime();
float percentage = ((float) breakTime / totalBreakTime) * 100f;
if (percentage > 50.0f) {
e.getNearbyEntities(5, 3, 5).stream()
.filter(Player.class::isInstance)
.map(Player.class::cast)
.forEach(p -> p.sendMessage("Your home door is halfway broken, watch out dude :("));
}
// Additional logic...
}
If you don't know what lynxplay is talking about: Read the contributing guidelines here: https://github.com/PaperMC/Paper/blob/master/CONTRIBUTING.md
yes I noticed I forgot to merge my patches :(
Are you going to fix the patch situation or do you want me to do that?
Are you going to fix the patch situation or do you want me to do that?
Yes please. I truly don't know how to do it. I tried merging my patches and it became even worse.