diff --git a/src/main/java/de/epiceric/shopchest/config/Config.java b/src/main/java/de/epiceric/shopchest/config/Config.java index 432ab65..5dca082 100644 --- a/src/main/java/de/epiceric/shopchest/config/Config.java +++ b/src/main/java/de/epiceric/shopchest/config/Config.java @@ -82,6 +82,9 @@ public class Config { /** Whether admin shops should be excluded of the shop limits **/ public boolean exclude_admin_shops; + /** Whether the extension of a potion or tipped arrow (if available) should be appended to the item name. **/ + public boolean append_potion_level_to_item_name; + /** Whether the shop items should be shown **/ public boolean show_shop_items; @@ -271,6 +274,7 @@ public class Config { enable_debug_log = plugin.getConfig().getBoolean("enable-debug-log"); explosion_protection = plugin.getConfig().getBoolean("explosion-protection"); exclude_admin_shops = plugin.getConfig().getBoolean("shop-limits.exclude-admin-shops"); + append_potion_level_to_item_name = plugin.getConfig().getBoolean("append-potion-level-to-item-name"); show_shop_items = plugin.getConfig().getBoolean("show-shop-items"); remove_shop_on_error = plugin.getConfig().getBoolean("remove-shop-on-error"); maximal_distance = plugin.getConfig().getDouble("maximal-distance"); diff --git a/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java b/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java index cc37898..9999218 100644 --- a/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java +++ b/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java @@ -949,11 +949,14 @@ public class LanguageUtils { if (stack.getItemMeta() instanceof PotionMeta) { PotionMeta meta = (PotionMeta) stack.getItemMeta(); PotionType potionType; + String upgradeString; if (Utils.getMajorVersion() < 9) { potionType = Potion.fromItemStack(stack).getType(); + upgradeString = (Potion.fromItemStack(stack).getTier() == Potion.Tier.TWO && plugin.getShopChestConfig().append_potion_level_to_item_name ? " II" : ""); } else { potionType = meta.getBasePotionData().getType(); + upgradeString = (meta.getBasePotionData().isUpgraded() && plugin.getShopChestConfig().append_potion_level_to_item_name ? " II" : ""); } for (PotionName potionName : potionNames) { @@ -961,31 +964,31 @@ public class LanguageUtils { if (Utils.getMajorVersion() < 9) { if (Potion.fromItemStack(stack).isSplash()) { if (potionName.getPotionItemType() == PotionName.PotionItemType.SPLASH_POTION && potionName.getPotionType() == potionType) { - return potionName.getLocalizedName(); + return potionName.getLocalizedName() + upgradeString; } } else { if (potionName.getPotionItemType() == PotionName.PotionItemType.POTION && potionName.getPotionType() == potionType) { - return potionName.getLocalizedName(); + return potionName.getLocalizedName() + upgradeString; } } } else { if (potionName.getPotionItemType() == PotionName.PotionItemType.POTION && potionName.getPotionType() == potionType) { - return potionName.getLocalizedName(); + return potionName.getLocalizedName() + upgradeString; } } } else { if (Utils.getMajorVersion() >= 9) { if (material == Material.LINGERING_POTION) { if (potionName.getPotionItemType() == PotionName.PotionItemType.LINGERING_POTION && potionName.getPotionType() == potionType) { - return potionName.getLocalizedName(); + return potionName.getLocalizedName() + upgradeString; } } else if (material == Material.TIPPED_ARROW) { if (potionName.getPotionItemType() == PotionName.PotionItemType.TIPPED_ARROW && potionName.getPotionType() == potionType) { - return potionName.getLocalizedName(); + return potionName.getLocalizedName() + upgradeString; } } else if (material == Material.SPLASH_POTION) { if (potionName.getPotionItemType() == PotionName.PotionItemType.SPLASH_POTION && potionName.getPotionType() == potionType) { - return potionName.getLocalizedName(); + return potionName.getLocalizedName() + upgradeString; } } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 91e27e9..83ed03c 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -21,6 +21,11 @@ enable-debug-log: false # Set whether players should be allowed to sell/buy broken items allow-broken-items: false +# Set whether the level of a potion or tipped arrow (if upgraded) should be appended to the item name. +# If set to true, the level ("II") will be displayed after the item name, but only if the item +# does NOT have a custom name. If set to false, it will only be shown in the shop info message. +append-potion-level-to-item-name: false + # Set whether shops should automatically be removed from the database if an error occurred while loading # e.g. when no chest is found at a shop's location # This might be useful if you're removing shop chests with WorldEdit, resetting plots, or similar