diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-04-25 16:23:33 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-05-09 01:40:19 -0500 |
commit | ef7e14f9ef95c528a6bb05d7b46fab9f6858435a (patch) | |
tree | d107196e3a62726d4f27e67d99ee23bff84e70c7 /src/main | |
parent | bbc3d31be70781c07933e582d7c3e8c70330671c (diff) | |
download | craftbukkit-ef7e14f9ef95c528a6bb05d7b46fab9f6858435a.tar craftbukkit-ef7e14f9ef95c528a6bb05d7b46fab9f6858435a.tar.gz craftbukkit-ef7e14f9ef95c528a6bb05d7b46fab9f6858435a.tar.lz craftbukkit-ef7e14f9ef95c528a6bb05d7b46fab9f6858435a.tar.xz craftbukkit-ef7e14f9ef95c528a6bb05d7b46fab9f6858435a.zip |
Fire events for fireball item usage. Fixes BUKKIT-1566
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/ItemFireball.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/ItemFireball.java b/src/main/java/net/minecraft/server/ItemFireball.java index 14b0b20e..3f01d931 100644 --- a/src/main/java/net/minecraft/server/ItemFireball.java +++ b/src/main/java/net/minecraft/server/ItemFireball.java @@ -1,5 +1,10 @@ package net.minecraft.server; +// CraftBukkit start +import org.bukkit.entity.Player; +import org.bukkit.event.block.BlockIgniteEvent; +// CraftBukkit end + public class ItemFireball extends Item { public ItemFireball(int i) { @@ -40,6 +45,21 @@ public class ItemFireball extends Item { int i1 = world.getTypeId(i, j, k); if (i1 == 0) { + // CraftBukkit start + org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(i, j, k); + Player thePlayer = (Player) entityhuman.getBukkitEntity(); + + BlockIgniteEvent eventIgnite = new BlockIgniteEvent(blockClicked, BlockIgniteEvent.IgniteCause.FIREBALL, thePlayer); + world.getServer().getPluginManager().callEvent(eventIgnite); + + if (eventIgnite.isCancelled()) { + if (!entityhuman.abilities.canInstantlyBuild) { + --itemstack.count; + } + return false; + } + // CraftBukkit end + world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, c.nextFloat() * 0.4F + 0.8F); world.setTypeId(i, j, k, Block.FIRE.id); } |