Renamed StringUtils.translate to StringUtils.format

This commit is contained in:
Auxilor
2021-07-20 00:16:46 +01:00
committed by Auxilor
parent 226ad14ede
commit b40c3a41c2
7 changed files with 34 additions and 36 deletions

View File

@@ -286,7 +286,7 @@ public class EcoJSONConfigWrapper implements JSONConfig {
public String getString(@NotNull final String path,
final boolean format) {
String string = Objects.requireNonNullElse(getOfKnownType(path, String.class), "");
return format ? StringUtils.translate(string) : string;
return format ? StringUtils.format(string) : string;
}
@Override
@@ -322,7 +322,7 @@ public class EcoJSONConfigWrapper implements JSONConfig {
final boolean format) {
List<String> strings = (List<String>) Objects.requireNonNullElse(getOfKnownType(path, Object.class), new ArrayList<>());
return format ? StringUtils.translateList(strings) : strings;
return format ? StringUtils.formatList(strings) : strings;
}
@Override

View File

@@ -202,7 +202,7 @@ public class EcoYamlConfigWrapper<T extends ConfigurationSection> implements Con
if (cache.containsKey(path)) {
return (String) cache.get(path);
} else {
cache.put(path, StringUtils.translate(Objects.requireNonNull(handle.getString(path, ""))));
cache.put(path, StringUtils.format(Objects.requireNonNull(handle.getString(path, ""))));
return getString(path);
}
}
@@ -214,7 +214,7 @@ public class EcoYamlConfigWrapper<T extends ConfigurationSection> implements Con
return (String) cache.get(path);
} else {
String string = Objects.requireNonNull(handle.getString(path, ""));
cache.put(path, format ? StringUtils.translate(string) : string);
cache.put(path, format ? StringUtils.format(string) : string);
return getString(path);
}
}
@@ -250,7 +250,7 @@ public class EcoYamlConfigWrapper<T extends ConfigurationSection> implements Con
public List<String> getStrings(@NotNull final String path,
final boolean format) {
if (cache.containsKey(path)) {
return format ? StringUtils.translateList((List<String>) cache.get(path)) : (List<String>) cache.get(path);
return format ? StringUtils.formatList((List<String>) cache.get(path)) : (List<String>) cache.get(path);
} else {
cache.put(path, has(path) ? new ArrayList<>(handle.getStringList(path)) : new ArrayList<>());
return getStrings(path);

View File

@@ -4,10 +4,8 @@ import com.willfp.eco.core.gui.menu.Menu;
import com.willfp.eco.core.gui.slot.FillerSlot;
import com.willfp.eco.core.gui.slot.Slot;
import com.willfp.eco.internal.gui.slot.EcoFillerSlot;
import com.willfp.eco.internal.gui.slot.EcoSlot;
import com.willfp.eco.util.StringUtils;
import lombok.Getter;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryCloseEvent;
@@ -90,7 +88,7 @@ public class EcoMenu implements Menu {
if (meta != null) {
List<String> lore = meta.getLore();
if (lore != null) {
lore.replaceAll(s -> StringUtils.translate(s, player));
lore.replaceAll(s -> StringUtils.format(s, player));
meta.setLore(lore);
}
slotItem.setItemMeta(meta);

View File

@@ -51,7 +51,7 @@ public class EcoMenuBuilder implements MenuBuilder {
@Override
public MenuBuilder setTitle(@NotNull final String title) {
this.title = StringUtils.translate(title);
this.title = StringUtils.format(title);
return this;
}

View File

@@ -17,16 +17,16 @@ public class EcoLogger extends Logger {
@Override
public void info(@NotNull final String msg) {
super.info(StringUtils.translate(msg));
super.info(StringUtils.format(msg));
}
@Override
public void warning(@NotNull final String msg) {
super.warning(StringUtils.translate(msg));
super.warning(StringUtils.format(msg));
}
@Override
public void severe(@NotNull final String msg) {
super.severe(StringUtils.translate(msg));
super.severe(StringUtils.format(msg));
}
}