Closed DrakePork closed 4 years ago
This error is now fixed!
I might be wrong, but looking at the code it shouldn't be fixed:
public boolean onBeingHit(EntityDamageByEntityEvent evt, int level, boolean usedHand) {
if (!(evt.getEntity() instanceof LivingEntity) ||
!ADAPTER.attackEntity((LivingEntity) evt.getEntity(), (Player) evt.getDamager(), 0)) {
return true;
}
}
We have already established that evt.getEntity()
is not of instance of LivingEntity
, so why cast it into a LivingEntity
?
The same goes for evt.getDamager()
. I assume evt.getDamager()
and evt.getEntity()
were mixed up?
Hi, should I have mentioned that the fix is on the dev branch? Sorry if this caused confusion. The offending code was removed in 4b51a7d47c21c6fc405bb13abae1a9aaa76a0dc9. Thanks for keeping me informed!
I'm a bit confused since I swear that this commit was pushed just a few hours ago. Anyways, I will try to reproduce it (once I am able to set up a 1.16.2 testing environment) and then make an update statement. anyways, thanks
Checked, and the issue (on the dev branch) should still occour. However, this test has been done logically, and not in a bukkit environment, which is quite different
The typecast in onBeingHit is safe because the type is checked in WatcherEnchant.java:154. I will change the type of the parameter in onBeingHit to Player, though.
Nevermind that's not how the code works. It's been a while since I looked at it
I know you dont have a 1.15 version out yet but uh after updating to 1.15 I started getting this warning in console when people hit mobs with custom enchants. Pastebin