From ef7e14f9ef95c528a6bb05d7b46fab9f6858435a Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Wed, 25 Apr 2012 16:23:33 -0500 Subject: Fire events for fireball item usage. Fixes BUKKIT-1566 --- src/main/java/net/minecraft/server/ItemFireball.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/main') 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); } -- cgit v1.2.3