Make "NaN" in placeholders translatable

This commit is contained in:
NotMyFault 2021-06-09 21:51:51 +02:00
parent f0cbc4f23e
commit 942d799c9c
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 7 additions and 1 deletions

View File

@ -178,7 +178,12 @@ public final class PlaceholderRegistry {
this.createPlaceholder("currentplot_x", (player, plot) -> Integer.toString(plot.getId().getX())); this.createPlaceholder("currentplot_x", (player, plot) -> Integer.toString(plot.getId().getX()));
this.createPlaceholder("currentplot_y", (player, plot) -> Integer.toString(plot.getId().getY())); this.createPlaceholder("currentplot_y", (player, plot) -> Integer.toString(plot.getId().getY()));
this.createPlaceholder("currentplot_xy", (player, plot) -> plot.getId().toString()); this.createPlaceholder("currentplot_xy", (player, plot) -> plot.getId().toString());
this.createPlaceholder("currentplot_rating", (player, plot) -> Double.toString(plot.getAverageRating())); this.createPlaceholder("currentplot_rating", (player, plot) -> {
if (Double.isNaN(plot.getAverageRating())) {
return legacyComponent(TranslatableCaption.of("placeholder.nan"), player);
}
return Double.toString(plot.getAverageRating());
});
this.createPlaceholder("currentplot_biome", (player, plot) -> plot.getBiomeSynchronous().toString()); this.createPlaceholder("currentplot_biome", (player, plot) -> plot.getBiomeSynchronous().toString());
} }

View File

@ -187,6 +187,7 @@
"core.prefix": "<dark_gray>[</dark_gray><gold>P2</gold><dark_gray>] </dark_gray>", "core.prefix": "<dark_gray>[</dark_gray><gold>P2</gold><dark_gray>] </dark_gray>",
"core.enabled": "<prefix><gold><value> is now enabled.</gold>", "core.enabled": "<prefix><gold><value> is now enabled.</gold>",
"placeholder.hooked": "<prefix><gold>PlotSquared hooked into MVdWPlaceholderAPI</gold>", "placeholder.hooked": "<prefix><gold>PlotSquared hooked into MVdWPlaceholderAPI</gold>",
"placeholder.nan": "Not a number",
"reload.reloaded_configs": "<prefix><gold>Translations and world settings have been reloaded successfully.</gold>", "reload.reloaded_configs": "<prefix><gold>Translations and world settings have been reloaded successfully.</gold>",
"reload.reload_failed": "<prefix><red>Failed to reload file configurations.</red>", "reload.reload_failed": "<prefix><red>Failed to reload file configurations.</red>",
"desc.desc_set": "<prefix><gray>Plot description set.</gray>", "desc.desc_set": "<prefix><gray>Plot description set.</gray>",