diff --git a/bukkit/src/main/java/net/leaderos/plugin/configuration/Language.java b/bukkit/src/main/java/net/leaderos/plugin/configuration/Language.java index 40d575062..531028fa9 100644 --- a/bukkit/src/main/java/net/leaderos/plugin/configuration/Language.java +++ b/bukkit/src/main/java/net/leaderos/plugin/configuration/Language.java @@ -371,9 +371,26 @@ public static class WebStoreGui extends OkaeriConfig { */ private String guiName = "&8WebStore"; + /** + * Price format + */ + @Comment({ + "Price format", + "{price} for original price (e.g. 10.00 USD)", + "{rawPrice} for raw price (e.g. 10.00)" + }) + private String priceFormat = "{price}"; + /** * Discounted price format */ + @Comment({ + "Discounted price format", + "{price} for original price (e.g. 10.00 USD)", + "{rawPrice} for raw price (e.g. 10.00)", + "{discountedPrice} for discounted price (e.g. 5.00 USD)", + "{rawDiscountedPrice} for raw discounted price (e.g. 5.00)" + }) private String discountedPriceFormat = "&c&m{price}&r &a{discountedPrice}"; /** diff --git a/bukkit/src/main/java/net/leaderos/plugin/configuration/lang/en.java b/bukkit/src/main/java/net/leaderos/plugin/configuration/lang/en.java index f1363723b..165c8b0c8 100644 --- a/bukkit/src/main/java/net/leaderos/plugin/configuration/lang/en.java +++ b/bukkit/src/main/java/net/leaderos/plugin/configuration/lang/en.java @@ -372,9 +372,26 @@ public static class WebStoreGui extends Language.Gui.WebStoreGui { */ private String guiName = "&8WebStore"; + /** + * Price format + */ + @Comment({ + "Price format", + "{price} for original price (e.g. 10.00 USD)", + "{rawPrice} for raw price (e.g. 10.00)" + }) + private String priceFormat = "{price}"; + /** * Discounted price format */ + @Comment({ + "Discounted price format", + "{price} for original price (e.g. 10.00 USD)", + "{rawPrice} for raw price (e.g. 10.00)", + "{discountedPrice} for discounted price (e.g. 5.00 USD)", + "{rawDiscountedPrice} for raw discounted price (e.g. 5.00)" + }) private String discountedPriceFormat = "&c&m{price}&r &a{discountedPrice}"; /** diff --git a/bukkit/src/main/java/net/leaderos/plugin/configuration/lang/tr.java b/bukkit/src/main/java/net/leaderos/plugin/configuration/lang/tr.java index bb3b8fc48..c46ad9919 100644 --- a/bukkit/src/main/java/net/leaderos/plugin/configuration/lang/tr.java +++ b/bukkit/src/main/java/net/leaderos/plugin/configuration/lang/tr.java @@ -371,9 +371,24 @@ public static class WebStoreGui extends Language.Gui.WebStoreGui { */ private String guiName = "&8Site Market"; + /** + * Price format + */ + @Comment({ + "Fiyat: {price} (örn. 10.00 TL)", + "Ham Fiyat: {rawPrice} (örn. 10.00)" + }) + private String priceFormat = "{price}"; + /** * Discounted price format */ + @Comment({ + "İndirimsiz Fiyat: {price} (örn. 10.00 TL)", + "Ham İndirimsiz Fiyat: {rawPrice} (örn. 10.00)", + "İndirimli Fiyat: {discountedPrice} (örn. 5.00 TL)", + "Ham İndirimli Fiyat: {rawDiscountedPrice} (örn. 5.00)", + }) private String discountedPriceFormat = "&c&m{price}&r &a{discountedPrice}"; /** diff --git a/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/model/Product.java b/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/model/Product.java index 76569f869..f527510ab 100644 --- a/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/model/Product.java +++ b/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/model/Product.java @@ -165,10 +165,16 @@ public ItemStack getProductIcon() { hasDiscount = true; int discountAmount = (int) (((getPrice() - getDiscountedPrice()) / getPrice()) * 100); + // Formatters of price + String priceFormat = Bukkit.getInstance().getLangFile().getGui().getWebStoreGui().getPriceFormat() + .replace("{price}", String.valueOf(priceText)) + .replace("{rawPrice}", String.valueOf(price)); // Formatters of discount String discountedPriceFormat = Bukkit.getInstance().getLangFile().getGui().getWebStoreGui().getDiscountedPriceFormat() .replace("{price}", String.valueOf(priceText)) - .replace("{discountedPrice}", String.valueOf(discountedPriceText)); + .replace("{rawPrice}", String.valueOf(price)) + .replace("{discountedPrice}", String.valueOf(discountedPriceText)) + .replace("{rawDiscountedPrice}", String.valueOf(discountedPrice)); String discountAmountFormat = Bukkit.getInstance().getLangFile().getGui().getWebStoreGui().getDiscountAmountFormat() .replace("{discount}", String.valueOf(discountAmount)); String stockUnlimited = Bukkit.getInstance().getLangFile().getGui().getWebStoreGui().getStockUnlimited(); @@ -183,7 +189,7 @@ public ItemStack getProductIcon() { else { displayName = displayName.replace("%discount_amount%", ""); lore = getProductLore().stream().map(key -> key.replace("%discount_amount%" , "") - .replace("%price%", String.valueOf(priceText))).collect(Collectors.toList()); + .replace("%price%", priceFormat)).collect(Collectors.toList()); } // Stock calculation for gui item