mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
2f34301581
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 Bukkit Changes: 7361a62e SPIGOT-5641: Add Block.getDrops(ItemStack, Entity) 1dc91b15 Add specific notes about what is not API 2b05ef88 #484: Allow statistics to be accessed for offline players CraftBukkit Changes:f7d6ad53
SPIGOT-5603: Use LootContext#lootingModifier in CraftLootTable5838285d
SPIGOT-5657: BlockPlaceEvent not cancelling for tripwire hooksf325b9be
SPIGOT-5641: Add Block.getDrops(ItemStack, Entity)e25a2272
Fix some formatting in CraftHumanEntity498540e0
Add Merchant slot delegateb2de47d5
SPIGOT-5621: Add missing container types for opening InventoryViewaa3a2f27
#645: Allow statistics to be accessed for offline players2122c0b1
#649: CraftBell should implement Bell
42 lines
2.1 KiB
Diff
42 lines
2.1 KiB
Diff
From b96a59506a52801bea29becdcc56226ec18af104 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 f861957842..a3fbdf5db5 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -452,8 +452,20 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
|
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.getBlockData().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) {
|
|
TileEntity tileentity = iblockdata.getBlock().isTileEntity() ? this.getTileEntity(blockposition) : null;
|
|
|
|
--
|
|
2.25.1
|
|
|