Make merchant accessible in PlayerPurchaseEvent#13062
Make merchant accessible in PlayerPurchaseEvent#13062Owen1212055 merged 2 commits intoPaperMC:mainfrom
PlayerPurchaseEvent#13062Conversation
lynxplay
left a comment
There was a problem hiding this comment.
Sounds sensible, however now we are kinda doubling the #getVillager method in the PlayerTradeEvent as #getMerchant yields the same.
It might be beneficial to mark the #getVillager method as obsolete, overide the #getMerchant method to yield an AbstractVillager in PlayerTradeEvent and then have #getVillager link to it.
64ec554 to
5ae3fdc
Compare
You're absolutely right! I have made the changes as you said. |
lynxplay
left a comment
There was a problem hiding this comment.
Neither of the events should be using jetbrains null-annotations, they are using jspecify already so should be fine without NotNull
5ae3fdc to
81774ec
Compare
Sure! I've corrected those. Could you please review again? |
Owen1212055
left a comment
There was a problem hiding this comment.
I dont really agree with obsoleting getVillager, especially because trade event can only be a villager. Otherwise looks good
81774ec to
da8bedc
Compare
Sure! I've removed that annotation |
When using a custom merchant, it's common to want to know whether a recipe is just used by listening PlayerPurchaseEvent. However, if we couldn't know which merchant players are trading with, we can't reach that goal.
So I just simply add the approach.