diff options
author | EvilSeph <evilseph@gmail.com> | 2011-09-21 18:54:31 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2011-09-21 22:13:54 -0400 |
commit | aa0739d90a534cb8072c1432250aecfdf228e9f6 (patch) | |
tree | ff2bc7288d5cb52966b48d9632b744e78e13d31f /src/main/java/net/minecraft/server/FoodMetaData.java | |
parent | 8d5a8667de3bd67e4230eeff2ed4d22c87350b3e (diff) | |
download | craftbukkit-aa0739d90a534cb8072c1432250aecfdf228e9f6.tar craftbukkit-aa0739d90a534cb8072c1432250aecfdf228e9f6.tar.gz craftbukkit-aa0739d90a534cb8072c1432250aecfdf228e9f6.tar.lz craftbukkit-aa0739d90a534cb8072c1432250aecfdf228e9f6.tar.xz craftbukkit-aa0739d90a534cb8072c1432250aecfdf228e9f6.zip |
Added FoodLevelChange event.
Diffstat (limited to 'src/main/java/net/minecraft/server/FoodMetaData.java')
-rw-r--r-- | src/main/java/net/minecraft/server/FoodMetaData.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java index d2106147..fe78d4ea 100644 --- a/src/main/java/net/minecraft/server/FoodMetaData.java +++ b/src/main/java/net/minecraft/server/FoodMetaData.java @@ -1,6 +1,9 @@ package net.minecraft.server; -import org.bukkit.event.entity.EntityDamageEvent; // CraftBukkit +// CraftBukkit start +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.FoodLevelChangeEvent; +// CraftBukkit end public class FoodMetaData { @@ -32,7 +35,14 @@ public class FoodMetaData { if (this.saturationLevel > 0.0F) { this.saturationLevel = Math.max(this.saturationLevel - 1.0F, 0.0F); } else if (i > 0) { - this.foodLevel = Math.max(this.foodLevel - 1, 0); + // CraftBukkit start + FoodLevelChangeEvent event = new FoodLevelChangeEvent(entityhuman.getBukkitEntity(), Math.max(this.foodLevel - 1, 0)); + entityhuman.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + this.foodLevel = event.getFoodLevel(); + } + // CraftBukkit end } } |