Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Add copy constructor to MerchantRecipe

Open Joo200 opened this issue 2 years ago • 5 comments

I want to create multiple Merchant with MerchantRecipes based on player permissions. The idea is: Store a List of MerchantRecipes and create a new Merchant for every player with custom uses.

It's not possible to clone MerchantRecipes so modifying the stored recipes will modify the results for other players too.

Joo200 avatar Dec 20 '22 14:12 Joo200

I thought Cloneable sucked. Wouldn't we be better off with a copy constructor instead? I know the api is full of "Cloneable"s but do we want to keep going down that path?

Machine-Maker avatar Dec 20 '22 18:12 Machine-Maker

ItemStack has already Cloneable that's why I used Cloneable here.

I don't see that advantage to use a copy instructor here. Cloneables are not that great but to have "some copy ctors" and "some cloneables" is not that great.

Joo200 avatar Dec 20 '22 19:12 Joo200

In general, I agree that moving away from cloneable is probably better. I'd just make a copy constructor as MM mentioned. 👍

Owen1212055 avatar Dec 23 '22 18:12 Owen1212055

I'll change it to a copy constructor next week

Joo200 avatar Dec 23 '22 18:12 Joo200

Changed to copy ctor

Joo200 avatar Dec 27 '22 11:12 Joo200