summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTravis Watkins <amaranth@ubuntu.com>2012-06-25 10:31:22 -0500
committerTravis Watkins <amaranth@ubuntu.com>2012-11-17 14:59:41 -0600
commit9ab40b1ab3cf2551bae0a81d606322affd66c51e (patch)
treeb811eb29efa19caaa71e7ae29c327bf7cde3d733
parent558411692a5995c91687ea6ca90cc9a26ada60ca (diff)
downloadcraftbukkit-9ab40b1ab3cf2551bae0a81d606322affd66c51e.tar
craftbukkit-9ab40b1ab3cf2551bae0a81d606322affd66c51e.tar.gz
craftbukkit-9ab40b1ab3cf2551bae0a81d606322affd66c51e.tar.lz
craftbukkit-9ab40b1ab3cf2551bae0a81d606322affd66c51e.tar.xz
craftbukkit-9ab40b1ab3cf2551bae0a81d606322affd66c51e.zip
Fire BlockFadeEvent when soil turns back to dirt. Fixes BUKKIT-1854
-rw-r--r--src/main/java/net/minecraft/server/BlockSoil.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java
index a245359d..dfff34c3 100644
--- a/src/main/java/net/minecraft/server/BlockSoil.java
+++ b/src/main/java/net/minecraft/server/BlockSoil.java
@@ -2,7 +2,10 @@ package net.minecraft.server;
import java.util.Random;
-import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
+// CraftBukkit start
+import org.bukkit.event.entity.EntityInteractEvent;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
public class BlockSoil extends Block {
@@ -37,6 +40,13 @@ public class BlockSoil extends Block {
if (l > 0) {
world.setData(i, j, k, l - 1);
} else if (!this.l(world, i, j, k)) {
+ // CraftBukkit start
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
+ if (CraftEventFactory.callBlockFadeEvent(block, Block.DIRT.id).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
+
world.setTypeId(i, j, k, Block.DIRT.id);
}
} else {
@@ -49,7 +59,7 @@ public class BlockSoil extends Block {
// CraftBukkit start - interact soil
org.bukkit.event.Cancellable cancellable;
if (entity instanceof EntityHuman) {
- cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
} else {
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(i, j, k));
world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);