Beautify empty /plot caps output

Also strip prefix from empty plot description
This commit is contained in:
NotMyFault 2021-05-07 09:59:17 +02:00
parent a990205d41
commit b37ad79e50
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
4 changed files with 8 additions and 4 deletions

View File

@ -97,8 +97,11 @@ public class Buy extends Command {
if (price <= 0) {
throw new CommandException(TranslatableCaption.of("economy.not_for_sale"));
}
checkTrue(this.econHandler.isSupported(),
TranslatableCaption.of("economy.vault_not_found")
);
checkTrue(
this.econHandler.getMoney(player) >= price && this.econHandler.isSupported(),
this.econHandler.getMoney(player) >= price,
TranslatableCaption.of("economy.cannot_afford_plot"),
Template.of("money", this.econHandler.format(price)),
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player)))

View File

@ -89,11 +89,12 @@ public class Caps extends SubCommand {
final int current = countedEntities[type];
final int max = plot.getFlag(capFlag);
final String percentage = String.format("%.1f", 100 * ((float) current / max));
String maxBeautified = max >= Integer.MAX_VALUE ? TranslatableCaption.of("info.infinite").getComponent(player) : String.valueOf(max);
player.sendMessage(
TranslatableCaption.of("info.plot_caps_format"),
Template.of("cap", name),
Template.of("current", String.valueOf(current)),
Template.of("limit", String.valueOf(max)),
Template.of("limit", maxBeautified),
Template.of("percentage", percentage)
);
}

View File

@ -42,7 +42,7 @@ import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "help",
aliases = "?",
category = CommandCategory.INFO,
usage = "help [category|#]",
usage = "help [category | #]",
permission = "plots.use")
public class Help extends Command {

View File

@ -338,7 +338,7 @@
"info.plot_info_creationdate": "<gold>Creation:</gold><gray> <creationdate></gray>",
"info.plot_user_list": "<gray><user></gray>",
"info.plot_flag_list": "<gray><flag>: <value></gray>",
"info.plot_no_description": "<prefix><gray>No description set.</gray>",
"info.plot_no_description": "<gray>No description set.</gray>",
"info.plot_caps_header": "<dark_gray><strikethrough>--------- <reset><gold>CAPS </gold><dark_gray><strikethrough>---------<reset>",
"info.plot_caps_format": "<prefix><gray>- Cap Type: </gray><gold><cap> </gold><gray>| Status: </gray><gold><current></gold><gray>/</gray><gold><limit> </gold><gray>(</gray><gold><percentage>%</gold><gray>)</gray>",
"info.plot_list_item": "<click:run_command:<command_tp>><hover:show_text:\"<command_tp>\"><dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray></hover></click><click:run_command:<command_info>> <hover:show_text:\"<hover_info>\"><gold> <plot></gold></hover></click><gray> - </gray><players>",