// Listen to player login event
PlayerEvents.loggedIn(event => {
  let player = event.player;
  // Check if player has already received starting items (using persistent data)
  if (!player.persistentData.startingItems) {
    // Give items
    player.give('minecraft:diamond_sword', 1);
    player.give('minecraft:apple', 5);
    // Mark as received
    player.persistentData.startingItems = true;
    // Optional: Send a welcome message
    player.tell('Welcome! You received your starting kit.');
  }
});