Paper/nms-patches/BlockLeaves.patch
2016-05-10 21:47:39 +10:00

27 lines
981 B
Diff

--- a/net/minecraft/server/BlockLeaves.java
+++ b/net/minecraft/server/BlockLeaves.java
@@ -3,6 +3,8 @@
import java.util.Random;
import javax.annotation.Nullable;
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
+
public abstract class BlockLeaves extends Block {
public static final BlockStateBoolean DECAYABLE = BlockStateBoolean.of("decayable");
@@ -133,6 +135,14 @@
}
private void b(World world, BlockPosition blockposition) {
+ // CraftBukkit start
+ LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled() || world.getType(blockposition).getBlock() != this) {
+ return;
+ }
+ // CraftBukkit end
this.b(world, blockposition, world.getType(blockposition), 0);
world.setAir(blockposition);
}