When I tried to change the wolf's max health, it said that it can only vary from 0.0 to 0.8 on a console error. Is there a way to override this?
Couldn't you simply apply a division factor to the damage the player does to the wolf ? Let's assume wolf has a fixed life of 0.8. Assume that your sword deals 0.2 damage on each hit. If you listen to entitydamagebyentityevent, and get the level of the player and use it to reduce the damage given to the wolf, it WILL be simpler. That way, all wolves have equal life and multiple players could hit it at once, each one with the right damage. I believe it's the simplest way, but again it all depends on what you intend to do with your plugin.
@Webbeh I can't do that. I need to fetch the wolf's health. And this health varies for different specified wolves.
Well then you need to apply different factors to the different kind of wolves. It's a bit more complex than simply setting a wolf's health, but isn't that difficult either. Also it's not like you had the choice...
@Webbeh is it a good idea to use a haspmap for <UUID> <Integer> to store health? And remove the hashes when the wolf dies? Its possible to increase a Player's health, so why not a wolf's?
I guess you can do that. Just be sure to remove the wolf from the hashmap when it dies, and to cancel the entity damage events.
@Hex_27 Dying is not the only case you have to worry about, the chunk said wolf is in may be unloaded, in which case, that would cause a memory leak. Does Damagable#setMaxHealth(double) not work?
@mythbusterma it says the wolf's max health can't exceed 0.0 to 0.8 in the console error. Bump EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Don't bump unnecessarily. You have the choice : use a divisor ratio (like I told you already) on the players' attacks, or use a hashmap on the mob to have the health. Or you can always create a new creature extending the wolf, but... that's a bit of an overkill.