Added numbers-only to above-max-level reformatting

This commit is contained in:
Auxilor 2021-08-11 13:45:46 +01:00
parent 1eac3022e4
commit 792684ecec
3 changed files with 24 additions and 6 deletions

View File

@ -260,15 +260,25 @@ public class EnchantmentCache {
if (level > enchantment.getMaxLevel() && PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().isReformatAboveMaxLevel()) {
String clone = rawName;
if (PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().isNumbersOnly()) {
String color = PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().getAboveMaxLevelFormat();
if (color.contains("{}")) {
numberString = color.replace("{}", numberString);
} else {
numberString = color + numberString;
}
String color = PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().getAboveMaxLevelFormat();
if (color.contains("{}")) {
clone = color.replace("{}", clone);
return StringUtils.format(clone + numberString);
} else {
clone = color + clone;
}
String color = PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().getAboveMaxLevelFormat();
if (color.contains("{}")) {
clone = color.replace("{}", clone);
} else {
clone = color + clone;
}
return StringUtils.format(clone + numberString);
return StringUtils.format(clone + numberString);
}
} else {
return name + numberString;
}

View File

@ -19,6 +19,12 @@ public class MaxLevelOptions extends PluginDependent<EcoPlugin> {
@Getter
private String aboveMaxLevelFormat;
/**
* If only the numbers should be formatted.
*/
@Getter
private boolean numbersOnly;
/**
* Create new description options.
*
@ -33,6 +39,7 @@ public class MaxLevelOptions extends PluginDependent<EcoPlugin> {
*/
public void update() {
reformatAboveMaxLevel = this.getPlugin().getConfigYml().getBool("lore.above-max-level.reformat");
numbersOnly = this.getPlugin().getConfigYml().getBool("lore.above-max-level.numbers-only");
aboveMaxLevelFormat = this.getPlugin().getLangYml().getBukkitHandle().getString("above-max-level-color");
}
}

View File

@ -33,6 +33,7 @@ lore:
# Format is available in lang.yml
above-max-level:
reformat: true
numbers-only: # If only the numbers should be reformatted
sort-by-type: false # Sort enchantments by type