Skip to main content

FTB Quests Integration

events.listen(onEvent('ftbquests.custom_task.75381f79', functionevent (event)=> {
  log.info('Custom task!')
  event.checkTimer = 20
  event.check = function (task, player) => {
    if (player.world.daytime && player.world.raining) {
      task.progress++
    }
  }
})

events.listen(onEvent('ftbquests.custom_reward.e4f76908', functionevent (event)=> {
  log.info('Custom reward!')
  event.player.tell('Hello!')
})

events.listen(// specific object completion
onEvent('ftbquests.completed.abc'd4f36905', functionevent => {
  if (event)event.player) {
    event.notifiedPlayers.tell('CustomText.of(`${event.player.name} taskcompleted... completed!'something!`).green())
  }
})

events.listen(// generic 'quest' object completion. Note: There isnt actually a way to get reliable title on server side, so dont use event.object.title
onEvent('ftbquests.completed', event => {
  if (event.player && event.object.objectType.id === 'quest') {
    event.notifiedPlayers.tell(Text.of(`${event.player.name} completed a quest!`).blue())
  }
})

// object with tag 'ding' completion
onEvent('ftbquests.completed.ding', functionevent (event)=> {
  event.onlineMembers.playSound('entity.experience_orb.pickup')
})

events.listen(onEvent('entity.death', functionevent (event)=> {
  if(event.server
  && event.source.actual
  && event.source.actual.player
  && event.source.actual.mainHandItem.id.equals(id === 'minecraft:wooden_sword')
  && event.entity.type.equals(type === 'minecraft:zombie')) {
    event.source.actual.data.ftbquests.addProgress('12345678', 1)
  }
})