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
1 changed files with 1 additions and 0 deletions

View File

@ -560,6 +560,7 @@ public class EventAbstractionListener extends AbstractListener {
@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()));
}