Bukkit/CraftBukkit — pull request #1374 by Eluinhost (2014-05-07 18:00:16+00:00)
Title: [C] Don't apply exhaustion when cancelling a EntityRegainHealthEvent. Fixes BUKKIT-5216

# The Issue:

When cancelling an EntityRegainHealthEvent caused by RegainReason.SATIATED the exhaustion penalty of 3.0F was still being applied. When cancelling all satiated events, any player below full health on near full hunger would start to lose a lot of hunger.

# Justification for this PR:

No response on the JIRA ticket. Personal use case in my plugin of cancelling all satiated events and having to currently use a workaround.

# PR Breakdown:

The heal method of the EntityLiving returns a boolean. True if the heal applied, false if it was cancelled. The FoodMetaData class uses this when ticking hunger. If the heal event applies the exhaustion gets applied. If it is cancelled no exhaustion is applied.

# Testing Results and Materials:

Simple plugin I used to test the results - https://github.com/Eluinhost/BUKKIT-5216-TEST

Here is the console output: http://puu.sh/8D0xo/08f4c98ca1.jpg
C being event cancelled, H being health before => health after, E being exhaustion before => exhaustion after

# Relevant PR(s):

None

# JIRA Ticket:

BUKKIT-5216 - https://bukkit.atlassian.net/browse/BUKKIT-5216