diff options
author | Andrew Ardill <andrew.ardill@gmail.com> | 2011-01-18 18:29:41 +1100 |
---|---|---|
committer | Andrew Ardill <andrew.ardill@gmail.com> | 2011-01-18 18:29:41 +1100 |
commit | e275f727d035f86ef44127460d4e217d340dd543 (patch) | |
tree | f1f7178c0ddb6b0935315c564982bf97481b5e77 /src/main/java/net/minecraft/server/BlockCactus.java | |
parent | 26a590f03018f011c29d17053219106929052a3b (diff) | |
download | craftbukkit-e275f727d035f86ef44127460d4e217d340dd543.tar craftbukkit-e275f727d035f86ef44127460d4e217d340dd543.tar.gz craftbukkit-e275f727d035f86ef44127460d4e217d340dd543.tar.lz craftbukkit-e275f727d035f86ef44127460d4e217d340dd543.tar.xz craftbukkit-e275f727d035f86ef44127460d4e217d340dd543.zip |
small change to block event with lava and cactus, to improve
readability and consistency
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockCactus.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockCactus.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java index 2f0aa35f..1d288217 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java @@ -9,6 +9,7 @@ import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.entity.EntityDamageByBlockEvent; import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; // CraftBukkit end import java.util.Random; @@ -100,16 +101,21 @@ public class BlockCactus extends Block { if(entity instanceof EntityLiving) { CraftServer server = ((WorldServer) world).getServer(); - CraftEntity toPassIn = new CraftLivingEntity(server, (EntityLiving) entity); - EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(((WorldServer) world).getWorld().getBlockAt(i, j, k), toPassIn, EntityDamageEvent.DamageCause.CONTACT, 1); + org.bukkit.block.Block damager = ((WorldServer) world).getWorld().getBlockAt(i, j, k); + org.bukkit.entity.Entity damagee = entity.getBukkitEntity(); + DamageCause damageType = EntityDamageEvent.DamageCause.CONTACT; + int damageDone = 1; + + EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone); server.getPluginManager().callEvent(edbbe); if (!edbbe.isCancelled()){ entity.a(((Entity) (null)), edbbe.getDamage()); } return; + } else { + entity.a(((Entity) (null)), 1); } - // CraftBukkit end - entity.a(((Entity) (null)), 1); + // CraftBukkit end } } |