13
0
geforkt von Mirrors/Paper
Paper/nms-patches/BlockLeaves.patch

27 Zeilen
1.1 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockLeaves.java
+++ b/net/minecraft/server/BlockLeaves.java
2019-04-23 04:00:00 +02:00
@@ -2,6 +2,8 @@
import java.util.Random;
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
+
2018-07-15 02:00:00 +02:00
public class BlockLeaves extends Block {
2019-04-23 04:00:00 +02:00
public static final BlockStateInteger DISTANCE = BlockProperties.ah;
@@ -21,6 +23,14 @@
@Override
public void c(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
2018-12-06 00:00:00 +01:00
if (!(Boolean) iblockdata.get(BlockLeaves.PERSISTENT) && (Integer) iblockdata.get(BlockLeaves.DISTANCE) == 7) {
2018-07-15 02:00:00 +02:00
+ // CraftBukkit start
+ LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getServer().getPluginManager().callEvent(event);
+
2018-07-15 02:00:00 +02:00
+ if (event.isCancelled() || world.getType(blockposition).getBlock() != this) {
+ return;
+ }
+ // CraftBukkit end
2019-04-23 04:00:00 +02:00
c(iblockdata, world, blockposition);
world.a(blockposition, false);
2018-07-15 02:00:00 +02:00
}