3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 04:50:05 +01:00
Paper/nms-patches/BlockLeaves.patch
2019-04-23 12:00:00 +10:00

27 Zeilen
1.1 KiB
Diff

--- a/net/minecraft/server/BlockLeaves.java
+++ b/net/minecraft/server/BlockLeaves.java
@@ -2,6 +2,8 @@
import java.util.Random;
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
+
public class BlockLeaves extends Block {
public static final BlockStateInteger DISTANCE = BlockProperties.ah;
@@ -21,6 +23,14 @@
@Override
public void c(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!(Boolean) iblockdata.get(BlockLeaves.PERSISTENT) && (Integer) iblockdata.get(BlockLeaves.DISTANCE) == 7) {
+ // 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
c(iblockdata, world, blockposition);
world.a(blockposition, false);
}