let BUTTON_BLOCKS = ['minecraft:stone_button']
let LEAVES_BLOCK = 'immersive_weathering:oak_leaf_pile';

// event listeners
onEvent("block.left_click", event => {

    //if (!arrayContains(item, LIGHTER_ITEMS)) return;
	
	//event.player.tell("face = " + event.block.properties.face)
	
    if(arrayContains(event.block, BUSH_BLOCKS) && event.block.properties.face == "floor") {
        event.block.set(LEAVES_BLOCK);
		event.server.runCommandSilent(`playsound minecraft:block.grass.break player @a ${event.player.x} ${event.player.y} ${event.player.z} 1`);
		//playsound minecraft:block.vine.break block Proxwian
		//event.cancel();
    }
});

function arrayContains(thing, array) {
    for (var a of array) {
      if (a == thing) return true;
   }
   return false;
};