Implement PlayerBookEditEvent. Adds BUKKIT-1995
Fix negative damage from Zombies. Fixes BUKKIT-4193

Currently, the method used for calculating the damage of zombies is scaled
to their health, but it uses the default max health rather than the real
max health value. If zombies have more health than the default max health
value, the amount of damage they deal becomes negative.

This is caused by EntityZombie.getMaxHealth() returning a hardcoded value of
20, which is the vanilla max health for zombies. Rather than using this value
when calculating zombie damage, the call is changed to instead use
((CraftLivingEntity) this.bukkitEntity).getMaxHealth(). This uses the true
maximum health of the Entity. "this.maxHealth" could be used instead of the
aforementioned method, however that creates a very unclear diff, and a
confusing change.
Correct cancellation of InventoryClickEvent. Fixes BUKKIT-4331

Cancelling an InventoryClickEvent for a single click causes the click not
to be processed by the clicked inventory. The server then doesn't
correctly identify their second click as being a double click, causing an
inconsistency between what the Player believes the inventory to be and
what the server believes the inventory to be.

This change forces an updateInventory call whenever an InventoryClickEvent
whose action is NOTHING is cancelled.  Both clicks are considered
PICKUP_ALL, so updating the inventory after the second click fixes any
inconsistencies that could arise between the client and the server.
Fix cancellation for InventoryDragEvent. Fixes BUKKIT-4332

Cancelling InventoryDragEvent causes the placed items to be lost.  This is
because the cursor is set to the result prior to the event taking place,
so the items are removed from the cursor. When the event is cancelled, the
items removed from the cursor aren't placed in the inventory, and are just
lost.

This change sets the cursor back to the original cursor when the event is
cancelled.
Updated version to 1.5.2-R1.0 in pom.xml for RB.
Updated version to 1.5.2-R1.1-SNAPSHOT for development towards next release.
Spigot
EMC POM changes
Misc EMC Changes

Only spawn 1 ocelot ever from eggs.
Load custom permissions before plugins
Unload plugins after everything else
Remove CraftBukkit "Feature" of ItemStack's having infinite use if less than 0 stack size.
Color name tags to match list
Make Durability enchant scale 0-80% reduction on Armor damage (up to level 5)
Zombies break down doors on normal
Update inventory on block place/interact cancellation
Mob Spawning Events

Add 2 events for better control of mob spawning (Natural and Spawners) This allows us a much more powerful control over spawning and improve performance
PlayerUseItem Event

This lets us control when an item is consumed and change the item.
EMC Anvil Tweaks

Make Items not have a repair cost increase due to Anvil usage.
Renaming is only 5 levels, combines include free renames.
Hidden Item Meta

This adds the ability to store hidden metadata in item lore.

Simply set a line to "&&::META" and every blank line before, that line, and every line after will be hidden from view on the client.

for example, you can set &&::META on line 20, and there will not be 19 blank lines before it.
Then you can store Data on 21+

Also adds a &&::SHINY tag to send a fake enchantment aura if it does not exists.
Must be set before META
NIOM - NIO Manager

Alternative to Netty
improve the existing network manager using Blocking NIO instead of IO (more effecient code)
Writes use a direct memory buffer for less copying, and more stable memory usage.

Reimplement Low Priority Queue
Optimized PacketQueue System that supports instant send notification to the writer thread
Removed packet queue walking since it will very unlikely ever be hit now.
Writer thread will now sleep longer until notified
Network threads are no longer interrupted every tick, letting them sleep as much as possible
Persistent Meta API

This adds an API for getting and setting PERSISTENT Metadata
Meta data can be stored on Entities, Chunks and at a Block level.
Meta is is provided in a simple Map/List setup and does not expose raw NBT access.
Chunk Save Reattempt

We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks.
Keep certain items on death API

This adds a getItemsToKeep to PlayerDeathEvent that can be modified for what item a player should keep upon death.

This can be used for never-to-be-dropped items.
Anvil Event

Fire an event for anvil usage
ArrowHitBlock Event
Entity Spawn Events

These events fire any time an entity is added/removed to the world, so we do not
have to check multiple locations for entities being added/removed from the world.