Beautify placeholder output for '*' permission

This commit is contained in:
N0tMyFaultOG 2020-12-27 19:16:26 +01:00
parent 867826759b
commit bf20b0dd79
No known key found for this signature in database
GPG Key ID: 823348042DA95A81
2 changed files with 9 additions and 2 deletions

View File

@ -78,7 +78,12 @@ public final class PlaceholderRegistry {
}); });
this.createPlaceholder("currentplot_world", player -> player.getLocation().getWorldName()); this.createPlaceholder("currentplot_world", player -> player.getLocation().getWorldName());
this.createPlaceholder("has_plot", player -> player.getPlotCount() > 0 ? "true" : "false"); this.createPlaceholder("has_plot", player -> player.getPlotCount() > 0 ? "true" : "false");
this.createPlaceholder("allowed_plot_count", player -> Integer.toString(player.getAllowedPlots())); this.createPlaceholder("allowed_plot_count", (player) -> {
if (player.getAllowedPlots() >= Integer.MAX_VALUE) { // Beautifies cases with '*' permission
return String.valueOf(TranslatableCaption.of("info.infinite"));
}
return Integer.toString(player.getAllowedPlots());
});
this.createPlaceholder("plot_count", player -> Integer.toString(player.getPlotCount())); this.createPlaceholder("plot_count", player -> Integer.toString(player.getPlotCount()));
this.createPlaceholder("currentplot_alias", (player, plot) -> { this.createPlaceholder("currentplot_alias", (player, plot) -> {
if (plot.getAlias() == null) { if (plot.getAlias() == null) {
@ -94,7 +99,8 @@ public final class PlaceholderRegistry {
try { try {
return PlayerManager.getName(plotOwner, false); return PlayerManager.getName(plotOwner, false);
} catch (final Exception ignored) {} } catch (final Exception ignored) {
}
return String.valueOf(TranslatableCaption.of("info.unknown")); return String.valueOf(TranslatableCaption.of("info.unknown"));
}); });

View File

@ -377,6 +377,7 @@
"info.unknown": "<gray>Unknown</gray>", "info.unknown": "<gray>Unknown</gray>",
"info.server": "<gray>Server</gray>", "info.server": "<gray>Server</gray>",
"info.everyone": "<gray>Everyone</gray>", "info.everyone": "<gray>Everyone</gray>",
"info.infinite": "<gray>Infinite</gray>",
"info.plot_unowned": "<prefix><gray>The current plot must have an owner to perform this action.</gray>", "info.plot_unowned": "<prefix><gray>The current plot must have an owner to perform this action.</gray>",
"info.plot_info_unclaimed": "<prefix><gray>Plot <gold><plot></gold> is not yet claimed.</gray>", "info.plot_info_unclaimed": "<prefix><gray>Plot <gold><plot></gold> is not yet claimed.</gray>",
"info.plot_info_header": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------</dark_gray><reset>", "info.plot_info_header": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------</dark_gray><reset>",