3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-20 21:40:06 +01:00
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
2018-07-15 02:00:00 +02:00
@@ -3,6 +3,8 @@
import java.util.Random;
2018-07-15 02:00:00 +02:00
import javax.annotation.Nullable;
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
+
2018-07-15 02:00:00 +02:00
public class BlockLeaves extends Block {
2018-08-26 04:00:00 +02:00
public static final BlockStateInteger DISTANCE = BlockProperties.ab;
2018-07-15 02:00:00 +02:00
@@ -20,6 +22,14 @@
2018-07-15 02:00:00 +02:00
public void b(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!((Boolean) iblockdata.get(BlockLeaves.PERSISTENT)).booleanValue() && ((Integer) iblockdata.get(BlockLeaves.DISTANCE)).intValue() == 7) {
+ // 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
iblockdata.a(world, blockposition, 0);
world.setAir(blockposition);
}