Fixed bug with price copying

This commit is contained in:
Auxilor
2022-11-23 22:31:37 +00:00
parent 47b72e9243
commit 52841f7f04
3 changed files with 12 additions and 3 deletions

View File

@@ -84,9 +84,12 @@ public final class PriceEconomy implements Price {
@Override
public @NotNull PriceEconomy withMultiplier(double multiplier) {
return new PriceEconomy(
PriceEconomy copy = new PriceEconomy(
baseContext,
ctx -> function.apply(ctx) * multiplier
);
copy.multipliers.putAll(this.multipliers);
return copy;
}
}

View File

@@ -149,10 +149,13 @@ public final class PriceItem implements Price {
@Override
public @NotNull PriceItem withMultiplier(double multiplier) {
return new PriceItem(
PriceItem copy = new PriceItem(
baseContext,
ctx -> function.apply(ctx) * multiplier,
item
);
copy.multipliers.putAll(this.multipliers);
return copy;
}
}