summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit
diff options
context:
space:
mode:
authorErik Broes <erikbroes@grum.nl>2011-03-23 16:38:42 +0100
committerErik Broes <erikbroes@grum.nl>2011-03-23 16:51:44 +0100
commit49043a8aff90ba6bde2d9f0d5de20898ec560217 (patch)
tree2a56fc6be87c0b66f9f2ec6fdf8361a3de8cf23c /src/main/java/org/bukkit
parentf33de669fb1cb86ba668d60ba2f2352fd63b4417 (diff)
downloadcraftbukkit-49043a8aff90ba6bde2d9f0d5de20898ec560217.tar
craftbukkit-49043a8aff90ba6bde2d9f0d5de20898ec560217.tar.gz
craftbukkit-49043a8aff90ba6bde2d9f0d5de20898ec560217.tar.lz
craftbukkit-49043a8aff90ba6bde2d9f0d5de20898ec560217.tar.xz
craftbukkit-49043a8aff90ba6bde2d9f0d5de20898ec560217.zip
Re-Implement BlockDamage
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index cd482be9..433cc33f 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -18,6 +18,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Type;
import org.bukkit.event.block.Action;
+import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
@@ -144,4 +145,19 @@ public class CraftEventFactory {
return event;
}
+
+ public static BlockDamageEvent callBlockDamageEvent(EntityHuman who, int x, int y, int z, ItemStack itemstack, boolean instaBreak) {
+ Player player = (who == null) ? null : (Player) who.getBukkitEntity();
+ CraftItemStack itemInHand = new CraftItemStack(itemstack);
+
+ CraftWorld craftWorld = (CraftWorld) player.getWorld();
+ CraftServer craftServer = (CraftServer) player.getServer();
+
+ Block blockClicked = craftWorld.getBlockAt(x, y, z);
+
+ BlockDamageEvent event = new BlockDamageEvent(player, blockClicked, itemInHand, instaBreak);
+ craftServer.getPluginManager().callEvent(event);
+
+ return event;
+ }
}