mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-23 09:37:51 +01:00
BlockMultiPlace has an immutable state list.
Fixes WORLDGUARD-4143.
This commit is contained in:
parent
fc0f7acab5
commit
1c3cf02ebd
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user