Skip to content

Commit 5a1e164

Browse files
Fix wrong price in price error message
1 parent 2f7bf83 commit 5a1e164

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/main/java/org/maxgamer/quickshop/api/shop/PriceLimiterCheckResult.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,27 @@ default double getPriceShouldBe() {
6868

6969
default void sendErrorMsg(QuickShop plugin, CommandSender sender, String input, String itemName) {
7070
boolean decFormat = plugin.getConfig().getBoolean("use-decimal-format");
71+
String maxPriceStr;
72+
String minPriceStr;
73+
if (decFormat) {
74+
maxPriceStr = MsgUtil.decimalFormat(getMax());
75+
minPriceStr = MsgUtil.decimalFormat(getMin());
76+
} else {
77+
maxPriceStr = Double.toString(getMax());
78+
minPriceStr = Double.toString(getMin());
79+
}
7180
switch (getStatus()) {
7281
case REACHED_PRICE_MIN_LIMIT:
7382
plugin.text().of(sender, "price-too-cheap",
74-
(decFormat) ? MsgUtil.decimalFormat(getMax())
75-
: Double.toString(getMin())).send();
83+
minPriceStr).send();
7684
case REACHED_PRICE_MAX_LIMIT:
7785
plugin.text().of(sender, "price-too-high",
78-
(decFormat) ? MsgUtil.decimalFormat(getMax())
79-
: Double.toString(getMin())).send();
86+
maxPriceStr).send();
8087
case PRICE_RESTRICTED:
8188
plugin.text().of(sender, "restricted-prices",
8289
itemName,
83-
String.valueOf(getMin()),
84-
String.valueOf(getMax())).send();
90+
minPriceStr,
91+
maxPriceStr).send();
8592
case NOT_VALID:
8693
plugin.text().of(sender, "not-a-number", input).send();
8794
case NOT_A_WHOLE_NUMBER:
@@ -91,8 +98,8 @@ default void sendErrorMsg(QuickShop plugin, CommandSender sender, String input,
9198
default:
9299
plugin.text().of(sender, "restricted-prices",
93100
itemName,
94-
String.valueOf(getMin()),
95-
String.valueOf(getMax())).send();
101+
minPriceStr,
102+
maxPriceStr).send();
96103
}
97104
}
98105
}

0 commit comments

Comments
 (0)