[SPIGOT-5700] PlayerAdvancementDoneEvent is fired for Recipes Created: 26/Apr/20  Updated: 29/Apr/20  Resolved: 29/Apr/20

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Jakub Zacek Assignee: Unassigned
Resolution: Invalid Votes: 0
Labels: event, spigot

Attachments: HTML File mclog    
Version: git-Spigot-e7dc2f5-a8ec1d6 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

PlayerAdvancementDoneEvent is called also for Recipes, but it should be fired only for Advancements.

 

Can be seen with: 

@EventHandler
public void advancementDone(PlayerAdvancementDoneEvent e) {
Bukkit.getLogger().info(e.getAdvancement().getKey().toString());
}


 Comments   
Comment by md_5 [ 29/Apr/20 ]

Not a bug.
There are separate advancements from recipes.
Eg look at the acacia_button advancement:

{
  "parent": "minecraft:recipes/root",
  "rewards": {
    "recipes": [
      "minecraft:acacia_button"
    ]
  },
  "criteria": {
    "has_planks": {
      "trigger": "minecraft:inventory_changed",
      "conditions": {
        "items": [
          {
            "item": "minecraft:acacia_planks"
          }
        ]
      }
    },
    "has_the_recipe": {
      "trigger": "minecraft:recipe_unlocked",
      "conditions": {
        "recipe": "minecraft:acacia_button"
      }
    }
  },
  "requirements": [
    [
      "has_planks",
      "has_the_recipe"
    ]
  ]
}

You can find these in data/minecraft/advancements/recipes

Comment by Jakub Zacek [ 27/Apr/20 ]

@md_5 From the name of the event I would expect it will be called only for "Stone Age". "Acquire Hardware", "Hot Stuff" etc. Advancements and for nothing else. From the log I have uploaded you can see, that it contains tons of Recipe discoveries, that I would expect under PlayerRecipeDiscoverEvent... But I may be wrong. If this is intended behaviour, please feel free to reject the JIRA...

Those outputs are done with the piece of code I have provided in description, so one line - one event call.

Comment by md_5 [ 26/Apr/20 ]

Pretty sure nearly every recipe has a coupled advancement

Generated at Fri Mar 14 15:12:59 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.