Fixed templates

Fixed item stack amount being changed permanently
This commit is contained in:
Teriuihi 2022-01-06 00:35:50 +01:00
parent 14e53de6e6
commit 0eb28ddf75
2 changed files with 8 additions and 4 deletions

View File

@ -35,7 +35,8 @@ public class BuyGUI extends GUIMerchant {
econUser.getPointsMap().get(villagerType.getName()),
0)))
)), villagerType);
for (ItemStack itemStack : villagerType.getBuying()) {
for (ItemStack is : villagerType.getBuying()) {
ItemStack itemStack = is.clone();
if (bulk)
itemStack.setAmount(itemStack.getMaxStackSize());
Price price = Utilities.getPrice(itemStack, WorthConfig.buy);
@ -96,7 +97,8 @@ public class BuyGUI extends GUIMerchant {
.toLowerCase().replaceAll("_", " "))),
Template.template("price", String.valueOf(cost)),
Template.template("points", String.valueOf(transPts)),
Template.template("total_points", String.valueOf(newPoints))
Template.template("total_points", String.valueOf(newPoints)),
Template.template("villager_name", villagerType.getDisplayName())
));
Bukkit.getServer().getPluginManager()

View File

@ -36,7 +36,8 @@ public class SellGUI extends GUIMerchant {
Template.template("points", String.valueOf(Objects
.requireNonNullElse(econUser.getPointsMap().get(villagerType.getName())
, 0))))), villagerType);
for (ItemStack itemStack : villagerType.getSelling()) {
for (ItemStack is : villagerType.getSelling()) {
ItemStack itemStack = is.clone();
if (bulk)
itemStack.setAmount(1);
Price price = Utilities.getPrice(itemStack, WorthConfig.sell);
@ -84,7 +85,8 @@ public class SellGUI extends GUIMerchant {
.toLowerCase().replaceAll("_", " "))),
Template.template("price", String.valueOf(cost)),
Template.template("points", String.valueOf(transPts)),
Template.template("total_points", String.valueOf(newPoints))
Template.template("total_points", String.valueOf(newPoints)),
Template.template("villager_name", villagerType.getDisplayName())
));
Bukkit.getServer().getPluginManager()