Added global price display names
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.willfp.eco.core.price;
|
||||
|
||||
import com.willfp.eco.core.Eco;
|
||||
import com.willfp.eco.core.config.interfaces.Config;
|
||||
import com.willfp.eco.core.placeholder.context.PlaceholderContext;
|
||||
import com.willfp.eco.core.price.impl.PriceFree;
|
||||
@@ -158,12 +159,27 @@ public final class ConfiguredPrice implements Price {
|
||||
if (!(
|
||||
config.has("value")
|
||||
&& config.has("type")
|
||||
&& config.has("display")
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String formatString = config.getString("display");
|
||||
String formatString;
|
||||
|
||||
String langConfig = Eco.get().getEcoPlugin().getLangYml()
|
||||
.getSubsections("price-display")
|
||||
.stream()
|
||||
.filter(section -> section.getString("type").equalsIgnoreCase(config.getString("type")))
|
||||
.findFirst()
|
||||
.map(section -> section.getString("display"))
|
||||
.orElse(null);
|
||||
|
||||
if (langConfig != null) {
|
||||
formatString = langConfig;
|
||||
} else if (config.has("display")) {
|
||||
formatString = config.getString("display");
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
Price price = Prices.create(
|
||||
config.getString("value"),
|
||||
|
||||
Reference in New Issue
Block a user