Ignore BlockFertilizeEvent with empty list.

Plugins can clear this list without fully cancelling the event.
Fixes #1723
This commit is contained in:
wizjany 2021-02-06 10:58:29 -05:00 committed by GitHub
parent 129d27351a
commit aeea455560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -560,6 +560,7 @@ public void onEntityInteract(EntityInteractEvent event) {
@EventHandler(ignoreCancelled = true)
public void onBlockFertilize(BlockFertilizeEvent event) {
if (event.getBlocks().isEmpty()) return;
Cause cause = create(event.getPlayer(), event.getBlock());
Events.fireToCancel(event, new PlaceBlockEvent(event, cause, event.getBlock().getWorld(), event.getBlocks()));
}