Skip to content

Commit

Permalink
Merge pull request #205 from BentoBoxWorld/Better_GUI_titles
Browse files Browse the repository at this point in the history
Makes GUI titles configurable in the locale files
  • Loading branch information
tastybento authored Oct 5, 2024
2 parents 2bb48e0 + 37e4c10 commit 78c07f0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ private void addEntityGroupLimits(IslandBlockCount ibc, Island island) {
});
groupMap.forEach((v, limit) -> {
PanelItemBuilder pib = new PanelItemBuilder();
pib.name(v.getName());
pib.name(user.getTranslation("island.limits.panel.entity-group-name-syntax", TextVariables.NAME,
v.getName()));
String description = "";
description += "(" + prettyNames(v) + ")\n";
pib.icon(v.getIcon());
Expand All @@ -145,7 +146,8 @@ private void addEntityLimits(IslandBlockCount ibc, Island island) {

map.forEach((k,v) -> {
PanelItemBuilder pib = new PanelItemBuilder();
pib.name(Util.prettifyText(k.toString()));
pib.name(user.getTranslation("island.limits.panel.entity-name-syntax", TextVariables.NAME,
Util.prettifyText(k.toString())));
Material m;
try {
if (E2M.containsKey(k)) {
Expand Down Expand Up @@ -175,7 +177,8 @@ private void addMaterialIcons(IslandBlockCount ibc, Map<Material, Integer> matLi
// Material limits
for (Entry<Material, Integer> en : matLimits.entrySet()) {
PanelItemBuilder pib = new PanelItemBuilder();
pib.name(Util.prettifyText(en.getKey().toString()));
pib.name(user.getTranslation("island.limits.panel.block-name-syntax", TextVariables.NAME,
Util.prettifyText(en.getKey().toString())));
// Adjust icon
pib.icon(B2M.getOrDefault(en.getKey(), en.getKey()));

Expand All @@ -197,7 +200,9 @@ public PanelItem getIcon() {

@Override
public String getName() {
return user.getTranslation(world, "limits.panel-title") + " " + sortBy.name();
String sort = user.getTranslation(world, "island.limits.panel." + sortBy);
return user.getTranslation(world, "island.limits.panel.title-syntax", "[title]",
user.getTranslation(world, "limits.panel-title"), "[sort]", sort);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public boolean execute(User user, String label, List<String> args) {
// Report the limit for the island, which is governed by the owner of the island
Optional<Island> opIsland = getIslands().getIslandAt(user.getLocation());
if (opIsland.isEmpty()) {
user.sendMessage("general.errors.no-island");
user.sendMessage("island.limits.errors.not-on-island");
return false;
}
Island island = opIsland.get();
Expand All @@ -60,7 +60,7 @@ public boolean execute(User user, String label, List<String> args) {
return false;
}
if (island.getOwner() == null) {
user.sendMessage("general.errors.no-owner");
user.sendMessage("island.limits.errors.no-owner");
return false;
}
new LimitPanel(addon).showLimits((GameModeAddon) getAddon(), user, island.getOwner());
Expand Down
13 changes: 11 additions & 2 deletions src/main/resources/locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ entity-limits:
limits:
panel-title: "Island limits"


admin:
limits:
main:
Expand Down Expand Up @@ -52,7 +51,17 @@ island:
max-color: "&c"
regular-color: "&a"
block-limit-syntax: "[number]/[limit]"
no-limits: "&cNo limits set in this world"
no-limits: "&c No limits set in this world"
panel:
title-syntax: '[title] [sort]'
entity-group-name-syntax: '[name]'
entity-name-syntax: '[name]'
block-name-syntax: '[name]'
A2Z: "a > z"
Z2A: "z > a"
errors:
no-owner: "&c That island has no owner"
not-on-island: "&c This location does not have limits set."
recount:
description: "recounts limits for your island"
now-recounting: "&b Now recounting. This could take a while, please wait..."
Expand Down

0 comments on commit 78c07f0

Please sign in to comment.