import { world, ItemStack } from "@minecraft/server";

world.afterEvents.playerSpawn.subscribe((event) => {
  const player = event.player;      
      
      if (!player.getDynamicProperty("hasReceivedAddonBook")) {
        const bookItem = new ItemStack("just:addon_book", 1);
        player.getComponent("inventory")?.container?.addItem(bookItem);
        player.setDynamicProperty("hasReceivedAddonBook", true);
      }
    }
)
