How to detect when a player completes an achievement

Discussion in 'Spigot Plugin Help' started by Ninjay_, Jun 13, 2021.

  1. Hello, I need to detect when a player completes an achievement, yes, I know there is the PlayerAdvancementDoneEvent, but in addition to detecting an achievement it also detects when a new craft is learned in the craft book, that is, I need an event or something similar to detect only when an achievement is made.
     
  2. You can just exclude the crafts using a simple check? Just get the Advancement, get its criteria and check those, I am fairly sure all those crafts should have something in common you can detect (as to finding what, just log the criteria first to see what it prints for crafts vs actual advancements).
     
    • Agree Agree x 1
  3. Thanks for your answer, I got a solution to my problem, basically I checked the achievement key.

    Code (Java):
    if(!e.getAdvancement().getKey().getKey().contains("recipes")) {