mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
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:
parent
c8989b3332
commit
61e5d9f1b6
@ -71,7 +71,6 @@ public class ComponentPresetManager {
|
|||||||
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ComponentPresetManager.class.getSimpleName());
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ComponentPresetManager.class.getSimpleName());
|
||||||
|
|
||||||
private final List<ComponentPreset> presets;
|
private final List<ComponentPreset> presets;
|
||||||
private final String guiName;
|
|
||||||
private final EconHandler econHandler;
|
private final EconHandler econHandler;
|
||||||
private final InventoryUtil inventoryUtil;
|
private final InventoryUtil inventoryUtil;
|
||||||
private File componentsFile;
|
private File componentsFile;
|
||||||
@ -104,15 +103,14 @@ public class ComponentPresetManager {
|
|||||||
|
|
||||||
final YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(this.componentsFile);
|
final YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(this.componentsFile);
|
||||||
|
|
||||||
if (!yamlConfiguration.contains("title")) {
|
if (yamlConfiguration.contains("title")) {
|
||||||
yamlConfiguration.set("title", "&6Plot Components");
|
yamlConfiguration.set("title", "#Now in /lang/messages_%.json, preset.title");
|
||||||
try {
|
try {
|
||||||
yamlConfiguration.save(this.componentsFile);
|
yamlConfiguration.save(this.componentsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.error("Failed to save default values to components.yml", e);
|
LOGGER.error("Failed to save default values to components.yml", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.guiName = yamlConfiguration.getString("title", "&6Plot Components");
|
|
||||||
|
|
||||||
if (yamlConfiguration.contains("presets")) {
|
if (yamlConfiguration.contains("presets")) {
|
||||||
this.presets = yamlConfiguration
|
this.presets = yamlConfiguration
|
||||||
@ -183,7 +181,8 @@ public class ComponentPresetManager {
|
|||||||
allowedPresets.add(componentPreset);
|
allowedPresets.add(componentPreset);
|
||||||
}
|
}
|
||||||
final int size = (int) Math.ceil((double) allowedPresets.size() / 9.0D);
|
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
|
@Override
|
||||||
public boolean onClick(final int index) {
|
public boolean onClick(final int index) {
|
||||||
if (!getPlayer().getCurrentPlot().equals(plot)) {
|
if (!getPlayer().getCurrentPlot().equals(plot)) {
|
||||||
|
@ -459,6 +459,7 @@
|
|||||||
"preset.preset_invalid": "<prefix><red>Could not generate a pattern from that preset.</red>",
|
"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_cost": "<prefix><gray>Cost: </gray><gold><cost></gold>",
|
||||||
"preset.preset_lore_component": "<gray>Component: </gray><gold><component></gold>",
|
"preset.preset_lore_component": "<gray>Component: </gray><gold><component></gold>",
|
||||||
|
"preset.title": "Plot Components",
|
||||||
"generic.generic_other": "<gray>other</gray>",
|
"generic.generic_other": "<gray>other</gray>",
|
||||||
"generic.generic_merged": "<gray>merged</gray>",
|
"generic.generic_merged": "<gray>merged</gray>",
|
||||||
"generic.generic_unowned": "<gray>unowned</gray>",
|
"generic.generic_unowned": "<gray>unowned</gray>",
|
||||||
|
Loading…
Reference in New Issue
Block a user