Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
Fixed #2837
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Feb 7, 2024
1 parent 4338c85 commit 6dc175f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.bukkit.block.BlockState;
import org.bukkit.craftbukkit.v1_16_R3.CraftServer;
import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock;
import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockMultiPlaceEvent;
Expand Down Expand Up @@ -80,7 +81,9 @@ public void onBlockPlace(BlockEvent.EntityPlaceEvent event) {
bukkitStack = player.getInventory().getItemInOffHand();
bukkitHand = EquipmentSlot.OFF_HAND;
}
BlockPlaceEvent placeEvent = new BlockPlaceEvent(placedBlock, placedBlock.getState(), againstBlock, bukkitStack, player, !event.isCanceled(), bukkitHand);
CraftBlockState replacedBlockState = CraftBlockState.getBlockState(event.getWorld(), event.getPos());
replacedBlockState.setData(event.getBlockSnapshot().getReplacedBlock());
BlockPlaceEvent placeEvent = new BlockPlaceEvent(placedBlock, replacedBlockState, againstBlock, bukkitStack, player, !event.isCanceled(), bukkitHand);
placeEvent.setCancelled(event.isCanceled());
Bukkit.getPluginManager().callEvent(placeEvent);
event.setCanceled(placeEvent.isCancelled() || !placeEvent.canBuild());
Expand Down

0 comments on commit 6dc175f

Please sign in to comment.