mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-24 00:51:22 +01:00
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:
parent
58eaf31879
commit
f677af566f
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user