Closed lokka30 closed 3 years ago
Attempted fix does not work.
@stumper66 would this be as simple a fix as for the magma cubes, ghasts, etc?
If the ender dragon is passed thru the mob spawn event I would think so. The question is, does it?
If the ender dragon is passed thru the mob spawn event I would think so. The question is, does it?
Confirmed that it isn't. I attempted to add ender dragon support at LevelManager.79 however my IDE told me that it is impossible for a LivingEntity to be instanceof EnderDragon.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/EnderDragon.html extends ComplexLivingEntity, Boss ComplexLivingEntity extends LivingEntity I'm wondering if any of the generic attributes apply.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/EnderDragon.html extends ComplexLivingEntity, Boss ComplexLivingEntity extends LivingEntity I'm wondering if any of the generic attributes apply.
An interesting thing is that you mentioned it extends Boss - the method already checks if it is instanceof Boss. Therefore when ender dragons spawn, the CreatureSpawnListener is not catching that. Possibly changing to EntitySpawnEvent could fix it, although it will require a few modifications to the listener since it otherwise would try to level non-creatures too.
I just did some quick testing and added the following code to the onMobSpawn event:
if (e.getEntity() instanceof EnderDragon) { EnderDragon ed = (EnderDragon)e.getEntity(); instance.phantomLogger.log(LogLevel.INFO, "spawned ender dragon"); }
I saw it log the ender dragon soon as I went to the end
It could be completely possible that this issue is invalid after all considering it already checks if the entity is instanceof Boss.
My IDE doesn't say this is possible, so I'm not going to bother testing it. I believe it could be something to do with CreatureSpawnEvent - we may need to use EntitySpawnEvent for these two entities only (EnderDragon & phantom).
Merged with #108.
Commit pushed which now makes CreatureSpawnListener also listen to EntitySpawnEvent and potentially force Ender Dragons and Phantoms to be levelled. Needs testing to confirm it works.
Finally fixed..7 months later
Attempted fix in upcoming release