[SPIGOT-1515] Method Entity#damage(Integer) doesn't call EntityDamageEvent Created: 25/Feb/16  Updated: 02/Jul/16  Resolved: 02/Jul/16

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Luke Kander Assignee: Unassigned
Resolution: Fixed Votes: 2
Labels: Bug, Entity, EntityDamageEvent
Environment:

Windows 10, latest build, IntelliJ enviorment



 Description   

I have this listener
[code]
@EventHandler(priority = EventPriority.HIGHEST)
public void damage(EntityDamageEvent e) {
nServer.log(Level.DEBUG, "IS PLAYER: " + (e.getEntity() instanceof Player));
if (e.getEntity() instanceof Player)

{ Player p = (Player) e.getEntity(); nServer.log(Level.DEBUG, "WONT KILL: " + (p.getHealth() - e.getDamage() > 0)); }

}
[/code]
And when I do Player#Damage(1000), the event doesn't fire...
A bug? Anyway I can bypass this?

Console:
[code]
//Fall damage
[23:11:14 INFO]: [nAPI] [DEBUG] IS PLAYER: true
[23:11:14 INFO]: [nAPI] [DEBUG] WILL KILL: false
//Kill command
[23:11:20 INFO]: DeprecatedLuke issued command /pluginkilltest
//EVENT NOT FIRED
[23:11:20 INFO]: DeprecatedLuke died
[/code]



 Comments   
Comment by Luke Kander [ 25/Feb/16 ]

My teammate did more research and indeed it doesn't fire the event

//player.damage(Double.parseDouble(args[1]));
[15:47:40 INFO]: x0Dan0x issued server command: /damage a 1
[15:47:40 INFO]: x0Dan0x issued server command: /damage a 1
[15:47:41 INFO]: x0Dan0x issued server command: /damage a 1
[15:47:42 INFO]: x0Dan0x issued server command: /damage a 1
[15:47:46 INFO]: x0Dan0x issued server command: /gamemode c
[15:47:50 INFO]: x0Dan0x issued server command: /gamemode s
//FALL DAMAGE
[15:48:00 INFO]: [nAPI] [DEBUG] IS PLAYER: true
[15:48:00 INFO]: [nAPI] [DEBUG] WONT KILL: true
//CHANGED TO Entity#damage(Double, Entity) and the even fires if it has an entity:
[15:50:09 INFO]: x0Dan0x issued server command: /damage a 1
//player.damage(Double.parseDouble(args[1]), player);
[15:50:09 INFO]: [nAPI] [DEBUG] IS PLAYER: true
[15:50:09 INFO]: [nAPI] [DEBUG] WONT KILL: true
Generated at Mon Mar 31 18:13:26 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.