Add "action prevented by easyPlace" message
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user