Files
CatServer/patches/net/minecraft/block/BlockLeaves.java.patch

28 lines
976 B
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
@@ -2,6 +2,9 @@
import java.util.Random;
import javax.annotation.Nullable;
+
+import org.bukkit.event.block.LeavesDecayEvent;
+
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
@@ -178,6 +181,14 @@
private void destroy(World worldIn, BlockPos pos)
{
+ // CraftBukkit start
+ LeavesDecayEvent event = new LeavesDecayEvent(worldIn.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
+ worldIn.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled() || worldIn.getBlockState(pos).getBlock() != this) {
+ return;
+ }
+ // CraftBukkit end
this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
worldIn.setBlockToAir(pos);
}