1.16.5 Check Advancement Types 1.12+

Discussion in 'Spigot Plugin Development' started by CroaBeast, Jun 28, 2021.

  1. Hello, I'm struggling about how do I check if and advancement is a task, a goal, or a challenge automatically.
    Is there a way to check that?
    Any examples of what can I do?
     
  2. What are you trying to do exactly with them?
     
  3. Edit the advancement messages depending its type
     
  4. It is p.hasAchievement(NAME) that the player gets an achievement for.
     
  5. Yeah, but it doesn't check if that advancement is a task, a goal or a challenge type.
     
  6. bump, want to know about this
     
  7. I think there's no method to do that.

    You could try making an API with advancementIterator() to solve your own question:coffee:
     
  8. Seems it's only possible with NMS.
    You can get the Advancement's NMS handle by casting it to its CraftBukkit counterpart, then using #getHandle.
    At that point, you can get the AdvancementDisplay (using #c in 1.16.5), and then get the AdvancementFrameType with #e (in 1.16.5) from there.
    Even if you use the advancement iterator, the Spigot API doesn't provide a way to see what type it is. An iterator won't help ya around that.
     
    #9 Escad, Jul 3, 2021
    Last edited: Jul 3, 2021
  9. Well, that's a shame
    is there an external API at least integrates that function to use it?
     
  10. Doubtful, but it's only a little extra work to scrap it together yourself. If you know about using Git, you could also PR it.
     
  11. I don't know what you're talking, but thanks for the suggestion, I guess xd