Changes to EntityDamageByEntity event called by skill damage mechanics are NOT reflected
Summary
EntityDamageByEntity events called by MythicMob skill damage mechanics do not consider if a another plugin changes the damage done via .setDamage() on those events.
Steps to reproduce
- Have an EventHandler to listen for an EntityDamageByEntity event
- If the damager of that event is from a Active Mob and that the damage is from a skill, then call .setDamage() on the event to change the damage value
- Seeing the damage in game shows that regardless of what you change the damage to, it doesn't actually affect how much damage the player takes
Current behavior
If another plugin listens for an EntityDamageByEntity event that is called by a MythicMob skill damage mechanic. If that plugin changes the actual damage via calling .setDamage(). Then it doesn't actually change how much damage the mob does with the skill.
Intended correct behavior
Changes to any event called by one plugin should be reflected by the plugin calling said event. If the damage is let's say multiplied by a custom armour mitigation (api implemented by another plugin), it should actually change how much damage that mob skill does to the player.
Server log file
Debug log snippet
Where it says Damage Modifier, this is how much the damage of the skill should be multiplied by.
- damage{amount=20} @trigger ~onDamaged
This is the skill that is used to test this. What the Heroes plugin is doing is modifying the damage of the EntityDamageByEntity event called by the above skill, and then it attempts to multiply it by 1.1. Which you would expect would give a damage amount of 22, however the skill still does 20 damage.
I have tested and confirmed that the code works for non skill related damage events.
Proposed fixes
- I am aware that MM uses NMS still to damage players and this might be why modifying the damage event doesn't make a difference. If this ISNT the case then it should be as simple as invoking .getDamage from the called event then applying the new damage (for ignore-armour skills, MythicMobs specifically calls an EntityDamageByEntity event I think).
- Another solution is to have a custom event; SkillDamageEvent or something that would be called before applying damage in the which would allow other plugins to modify how much damage a MythicMob will do
- Third solution is, maybe this is possible already but I'm unaware of the API used to accomplish this (but as far as I can tell from inspecting the code, there is no other way to do this)