mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-22 10:22:29 +00:00
Added possibility to append potion level to item name
This commit is contained in:
parent
7e24b8e596
commit
20badd36fb
@ -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");
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user