diff --git a/scripts/rules/easyPlace.js b/scripts/rules/easyPlace.js index 5d15a5c..0c88a38 100644 --- a/scripts/rules/easyPlace.js +++ b/scripts/rules/easyPlace.js @@ -33,7 +33,8 @@ function hasActionItemInCorrectSlot(player) { } function tryPlaceBlock(event, player, block, structureBlock) { - if (isBannedBlock(player, structureBlock)) return; + if (isBannedBlock(player, structureBlock)) + preventAction(event, player); structureBlock = tryConvertBannedToValidBlock(structureBlock); if (player.getGameMode() === GameMode.creative) { placeBlock(block, structureBlock); @@ -43,6 +44,13 @@ function tryPlaceBlock(event, player, block, structureBlock) { } } +function preventAction(event, player) { + event.cancel = true; + system.run(() => { + player.onScreenDisplay.setActionBar('§cAction prevented by easyPlace.'); + }); +} + function isBannedBlock(player, structureBlock) { const blockId = structureBlock.type.id.replace('minecraft:', ''); if (bannedBlocks.includes(blockId))