From f7dd8af35e573967413b248ce25f1b2b77dbc78a Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Sun, 1 Nov 2020 23:05:41 +0100 Subject: [PATCH] Enhance plot claim message --- .../src/main/java/com/plotsquared/core/command/Auto.java | 9 ++++++--- Core/src/main/java/com/plotsquared/core/command/Buy.java | 3 ++- .../main/java/com/plotsquared/core/command/Claim.java | 6 ++++-- Core/src/main/resources/lang/messages_en.json | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Auto.java b/Core/src/main/java/com/plotsquared/core/command/Auto.java index 6cdbdf627..234499e9f 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Auto.java +++ b/Core/src/main/java/com/plotsquared/core/command/Auto.java @@ -108,10 +108,12 @@ public class Auto extends SubCommand { if (metaDataAccess.isPresent()) { int grantedPlots = metaDataAccess.get().orElse(0); if (diff < 0 && grantedPlots < sizeX * sizeZ) { - player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots")); + player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"), + Template.of("amount", String.valueOf(diff + grantedPlots))); return false; } else if (diff >= 0 && grantedPlots + diff < sizeX * sizeZ) { - player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots")); + player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"), + Template.of("amount", String.valueOf(diff + grantedPlots))); return false; } else { int left = grantedPlots + diff < 0 ? 0 : diff - sizeX * sizeZ; @@ -125,7 +127,8 @@ public class Auto extends SubCommand { Template.of("remainingGrants", String.valueOf(left))); } } else { - player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots")); + player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"), + Template.of("amount", "0")); return false; } } diff --git a/Core/src/main/java/com/plotsquared/core/command/Buy.java b/Core/src/main/java/com/plotsquared/core/command/Buy.java index a4326112a..c7074abc5 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Buy.java +++ b/Core/src/main/java/com/plotsquared/core/command/Buy.java @@ -87,7 +87,8 @@ public class Buy extends Command { checkTrue(!plot.isOwner(player.getUUID()), TranslatableCaption.of("economy.cannot_buy_own")); Set plots = plot.getConnectedPlots(); checkTrue(player.getPlotCount() + plots.size() <= player.getAllowedPlots(), - TranslatableCaption.of("permission.cant_claim_more_plots")); + TranslatableCaption.of("permission.cant_claim_more_plots"), + Template.of("amount", String.valueOf(player.getAllowedPlots()))); double price = plot.getFlag(PriceFlag.class); if (price <= 0) { throw new CommandException(TranslatableCaption.of("economy.not_for_sale")); diff --git a/Core/src/main/java/com/plotsquared/core/command/Claim.java b/Core/src/main/java/com/plotsquared/core/command/Claim.java index 92646e6e2..8e0ad7815 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Claim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Claim.java @@ -104,10 +104,12 @@ public class Claim extends SubCommand { grants = metaDataAccess.get().orElse(0); if (grants <= 0) { metaDataAccess.remove(); - player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots")); + player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"), + Template.of("amount", String.valueOf(grants))); } } else { - player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots")); + player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"), + Template.of("amount", String.valueOf(grants))); } } diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index d2035e6aa..e0b03fb9e 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -208,7 +208,7 @@ "permission.no_permission": "You are lacking the permission node: .", "permission.no_permission_event": "You are lacking the permission node: .", "permission.no_plot_perms": "You must be the plot owner to perform this action.", - "permission.cant_claim_more_plots": "You can't claim more plots.", + "permission.cant_claim_more_plots": "You can't claim more than plots.", "permission.cant_claim_more_clusters": "You can't claim more clusters.", "permission.cant_transfer_more_plots": "You can't send more plots to that user.", "permission.cant_claim_more_plots_num": "You can't claim more than plots at once.",