geforkt von Mirrors/Paper
0976d52bbd
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Please note that this build includes changes to meet upstreams requirements for nullability annotations. While we aim for a level of accuracy, these might not be 100% correct, if there are any issues, please speak to us on discord, or open an issue on the tracker to discuss. Bukkit Changes: 9a6a1de3 Remove nullability annotations from enum constructors 3f0591ea SPIGOT-2540: Add nullability annotations to entire Bukkit API CraftBukkit Changes:8d8475fc
SPIGOT-4666: Force parameter in HumanEntity#sleep8b1588e2
Fix ExplosionPrimeEvent#setFire not working with EnderCrystals39a287b7
Don't ignore newlines in PlayerListHeader/Footer Spigot Changes: cf694d87 Add nullability annotations
42 Zeilen
2.1 KiB
Diff
42 Zeilen
2.1 KiB
Diff
From 2ca9c446682f9983713744f955af985a4e0190d3 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Wed, 6 Feb 2019 00:20:33 -0500
|
|
Subject: [PATCH] BlockDestroyEvent
|
|
|
|
Adds an event for when the server is going to destroy a current block,
|
|
potentially causing it to drop. This event can be cancelled to avoid
|
|
the block destruction, such as preventing signs from popping when
|
|
floating in the air.
|
|
|
|
This can replace many uses of BlockPhysicsEvent
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index 380ef602e..4d3f88431 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -548,8 +548,20 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
|
return false;
|
|
} else {
|
|
Fluid fluid = this.getFluid(blockposition);
|
|
+ // Paper start - while the above setAir method is named same and looks very similar
|
|
+ // they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent,
|
|
+ // it doesn't imply destruction of a block that plays a sound effect / drops an item.
|
|
+ boolean playEffect = true;
|
|
+ if (com.destroystokyo.paper.event.block.BlockDestroyEvent.getHandlerList().getRegisteredListeners().length > 0) {
|
|
+ com.destroystokyo.paper.event.block.BlockDestroyEvent event = new com.destroystokyo.paper.event.block.BlockDestroyEvent(MCUtil.toBukkitBlock(this, blockposition), fluid.i().createCraftBlockData(), flag);
|
|
+ if (!event.callEvent()) {
|
|
+ return false;
|
|
+ }
|
|
+ playEffect = event.playEffect();
|
|
+ }
|
|
+ // Paper end
|
|
|
|
- this.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata));
|
|
+ if (playEffect) this.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata)); // Paper
|
|
if (flag) {
|
|
iblockdata.a(this, blockposition, 0);
|
|
}
|
|
--
|
|
2.21.0
|
|
|