From 516f26e2b22fcc2a0e7620f4bb5c25d4eef03c85 Mon Sep 17 00:00:00 2001 From: ForestOfLight Date: Sun, 13 Apr 2025 13:36:16 -0700 Subject: [PATCH] Add "action prevented by easyPlace" message --- scripts/rules/easyPlace.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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))