why i can't replace the world.sensMessage with for example player.runCommand he's say player is not defined why ?
thsi is the cod
function checkItem() {
const overworld = world.getDimension("overworld");
const items = overworld.getEntities({ type: "minecraft:item" }).filter(i => i.getComponent("minecraft:item").itemStack.typeId == "minecraft:stick");
if(!items) return;
const locs = items.map(item => item.location);
for(let i = 0; i < items.length; i++) {
const { x, y, z } = items[i].location;
if(overworld.getBlock({ x, y: y - 1, z }).typeId == "minecraft:stone"){
world.sendMessage("It works!");
items[i].kill();
}
}
};