summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
authorEvilSeph <evilseph@gmail.com>2011-09-21 17:11:06 -0400
committerEvilSeph <evilseph@gmail.com>2011-09-21 17:11:06 -0400
commit217b4141186b7034f7c14335a20e0b9934a35121 (patch)
treed783ff1faa009a25841ed88e3bf1edb1cf55f614 /src/main/java/net
parente6e9cec1e9b0b718d19816a767845a27fdffcb66 (diff)
downloadcraftbukkit-217b4141186b7034f7c14335a20e0b9934a35121.tar
craftbukkit-217b4141186b7034f7c14335a20e0b9934a35121.tar.gz
craftbukkit-217b4141186b7034f7c14335a20e0b9934a35121.tar.lz
craftbukkit-217b4141186b7034f7c14335a20e0b9934a35121.tar.xz
craftbukkit-217b4141186b7034f7c14335a20e0b9934a35121.zip
Added EntityDamageEvent for caused by starving.
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/FoodMetaData.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
index eb4213c5..d2106147 100644
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import org.bukkit.event.entity.EntityDamageEvent; // CraftBukkit
+
public class FoodMetaData {
// CraftBukkit start - all made public
@@ -44,7 +46,14 @@ public class FoodMetaData {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
if (entityhuman.health > 10 || i >= 3 || entityhuman.health > 1 && i >= 2) {
- entityhuman.damageEntity(DamageSource.STARVE, 1);
+ // CraftBukkit start
+ EntityDamageEvent event = new EntityDamageEvent(entityhuman.getBukkitEntity(), EntityDamageEvent.DamageCause.STARVATION, 1);
+ entityhuman.world.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ entityhuman.damageEntity(DamageSource.STARVE, event.getDamage());
+ }
+ // CraftBukkit end
}
this.foodTickTimer = 0;