Java Reference
In-Depth Information
Great! Now for a few jumps:
Ah, right. The cow died. We ran into that same problem back in the CowShooter
plugin—we have to set the cow's health to the max using something like this:
But where should we do it? And what else do we need to finish up this plugin?
The current version is working but has a problem. Do a gitcommit to save the
current state of the code at this point before we start making more major
Knit It All Together
We need to add a few things from our list of materials and take care of a
couple of problems.
First off, we need to fix the dying cows, so let's add an event handler to listen
for DamageHook , and cancel the event if its cause is DamageType.FALL . Ah, if we
cancel the damage event, we don't need to bump up the cow's health.
When testing the spawn function and the jump, we used ourselves as the
target. We need to do a little better than that, so we'll have to add a getClosest-
Player() function to find the closest player to any given cow.
And as we saw earlier, we need to pick an event to use to spawn these
creeper cows. There are probably a couple of ways to do that. You don't want
to spawn cows all over the world; it would be great if there were an event that
gets sent when each new chunk of the world gets loaded into the server.
Search WWH ::

Custom Search