Don't try dropping items from falling blocks that won't drop one.

To quote myself from the adjacent commit almost exactly one year ago,
"some plugins do weird things with falling blocks."

Fixes #1624.
This commit is contained in:
wizjany 2020-08-07 13:59:22 -04:00
parent 58eaf31879
commit f677af566f

View File

@ -323,8 +323,10 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) {
Events.fireToCancel(event, new PlaceBlockEvent(event, cause, block.getLocation(), toType));
if (entity instanceof FallingBlock) {
try {
if (event.isCancelled() && !wasCancelled) {
FallingBlock fallingBlock = (FallingBlock) entity;
if (!fallingBlock.getDropItem()) return;
final Material material = fallingBlock.getBlockData().getMaterial();
if (!material.isItem()) return;
ItemStack itemStack = new ItemStack(material, 1);
@ -334,11 +336,13 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) {
item.remove();
}
}
} finally {
Cause.untrackParentCause(entity);
}
}
}
}
}
@EventHandler(ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent event) {