Closed timderspieler closed 1 month ago
it depends on what effect you are listening to. Debug and see what effect this was for. Having both main and other entity the same could be valid in a lot of cases
@ThomasWega as mentioned this was tested with the poison enchantment.
Now, this might be super confusing that it even got me, but I don't think it's actually a bug. You can get the entities with getAttacker and getVictim as well. That should work just fine for most cases. I'd like to fix this and make it cleaner, but that would break compatibility, which we want to avoid unless really necessary. Hopefully this answer is enough for you
Describe the bug
Following the advice mentioned in following issue on github: https://github.com/GC-spigot/AdvancedEnchantments/issues/4184 I've switched from the EnchantActivateEvent to the EffectsActivateEvent.
While testing the new code, I noticed that event.getMainEntity() and event.getOtherEntity() both return the same LivingEntity object.
The expected behaviour would be that event.getMainEntity() returns the object of the LivingEntity that holds the enchanted item / activated the effect and event.getOtherEntity() returns the object of the LivingEntity that the effect gets activated on (target).
How to reproduce
Enchant a weapon with e.g the poison enchantment. Hit another player. The LivingEntity event.getMainEntity() will return the attacker, event.getOtherEntity() will also return the attacker.
Following code:
will print out the message seen in the screenshots section.
Screenshots / Videos
"/ae plinfo" link
Not needed.
Server Log
No response