Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Villager#setVillagerLevel does not update new trades

Open Euphillya opened this issue 3 years ago • 2 comments

Expected behavior

When we choose a level of trade of the villager and he has well on the profession, that it unlocks the trades of the level.

Observed/Actual behavior

Nothing happens except for an increase in the selling price of the first 2 trades

Steps/models to reproduce

villager.setVillagerLevel(3); // By example

image

Plugin and Datapack List

Plugins (18): CMILib, Custom_items, DataManager, Eris, Essentials, FastAsyncWorldEdit (WorldEdit), Insights, MobFarmManager, NBTAPI, NMS_IMPLEMENTATION, PlaceholderAPI, ShopGUIPlus, SkyblockVP, SkyblockVP_Extends_IsValue, SkyblockvpMineralGenerator, TAB, Vault, VoidPlot

Paper version

[00:57:32 INFO]: Checking version, please wait... [00:57:33 INFO]: This server is running Paper version git-Paper-211 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT) (Git: eb68bd4) You are running the latest version Previous version: git-Paper-196 (MC: 1.19.2)

Other

No response

Euphillya avatar Oct 14 '22 22:10 Euphillya

Ok, so when a villager's level changes in vanilla, a method called "updateTrades" is called which recalculates the trades based on the new level. Question is, should the API do this automatically when someone changes the level, or should a new API method be added to manually update the trades?

EDIT: I'm leaning in favor of having a separate method. The other villager attribute that determines available trades is the villager profession. Currently, when that is changed, trades aren't updated either. I think adding a refreshTrades method and then adding it to the documentation for both setType and setVillagerLevel is the best approach.

Machine-Maker avatar Oct 15 '22 17:10 Machine-Maker

But in vanilla each level can grant a new recipe for this villager, so we can't just provide an update method for that Each level gained should called this method to behave the same as vanilla so for example if a plugin increase the level by 2 this method should be called two times per increment. Also another question is should we support the recipe regression when a villager loose its level ?

Lulu13022002 avatar Oct 15 '22 18:10 Lulu13022002