Skip to content
Permalink
Browse files

BlockMultiPlace has an immutable state list.

Fixes WORLDGUARD-4143.
  • Loading branch information...
wizjany committed Sep 22, 2019
1 parent fc0f7ac commit 1c3cf02ebd4cbf0f5d20fdc15262c770a7661e91
@@ -177,8 +177,14 @@ public void onBlockBreak(BlockBreakEvent event) {

@EventHandler(ignoreCancelled = true)
public void onBlockMultiPlace(BlockMultiPlaceEvent event) {
Events.fireToCancel(event, new PlaceBlockEvent(event, create(event.getPlayer()),
event.getBlock().getWorld(), event.getReplacedBlockStates()));
List<Block> placed = event.getReplacedBlockStates().stream().map(BlockState::getBlock).collect(Collectors.toList());
int origAmt = placed.size();
PlaceBlockEvent delegateEvent = new PlaceBlockEvent(event, create(event.getPlayer()), event.getBlock().getWorld(),
placed, event.getBlockPlaced().getType());
Events.fireToCancel(event, delegateEvent);
if (origAmt != placed.size()) {
event.setCancelled(true);
}
}

@EventHandler(ignoreCancelled = true)

0 comments on commit 1c3cf02

Please sign in to comment.
You can’t perform that action at this time.