Move /p components title to translations file matching other parts of components

- Also component-ify title, this must not be limited to a String.
This commit is contained in:
NotMyFault 2021-09-15 11:13:03 +02:00
parent c8989b3332
commit 61e5d9f1b6
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 5 additions and 5 deletions

View File

@ -71,7 +71,6 @@ public class ComponentPresetManager {
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ComponentPresetManager.class.getSimpleName());
private final List<ComponentPreset> presets;
private final String guiName;
private final EconHandler econHandler;
private final InventoryUtil inventoryUtil;
private File componentsFile;
@ -104,15 +103,14 @@ public class ComponentPresetManager {
final YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(this.componentsFile);
if (!yamlConfiguration.contains("title")) {
yamlConfiguration.set("title", "&6Plot Components");
if (yamlConfiguration.contains("title")) {
yamlConfiguration.set("title", "#Now in /lang/messages_%.json, preset.title");
try {
yamlConfiguration.save(this.componentsFile);
} catch (IOException e) {
LOGGER.error("Failed to save default values to components.yml", e);
}
}
this.guiName = yamlConfiguration.getString("title", "&6Plot Components");
if (yamlConfiguration.contains("presets")) {
this.presets = yamlConfiguration
@ -183,7 +181,8 @@ public class ComponentPresetManager {
allowedPresets.add(componentPreset);
}
final int size = (int) Math.ceil((double) allowedPresets.size() / 9.0D);
final PlotInventory plotInventory = new PlotInventory(this.inventoryUtil, player, size, this.guiName) {
final PlotInventory plotInventory = new PlotInventory(this.inventoryUtil, player, size,
TranslatableCaption.of("preset.title").getComponent(player)) {
@Override
public boolean onClick(final int index) {
if (!getPlayer().getCurrentPlot().equals(plot)) {

View File

@ -459,6 +459,7 @@
"preset.preset_invalid": "<prefix><red>Could not generate a pattern from that preset.</red>",
"preset.preset_lore_cost": "<prefix><gray>Cost: </gray><gold><cost></gold>",
"preset.preset_lore_component": "<gray>Component: </gray><gold><component></gold>",
"preset.title": "Plot Components",
"generic.generic_other": "<gray>other</gray>",
"generic.generic_merged": "<gray>merged</gray>",
"generic.generic_unowned": "<gray>unowned</gray>",