Enhance plot claim message

This commit is contained in:
N0tMyFaultOG 2020-11-01 23:05:41 +01:00 committed by dordsor21
parent bc32581cbd
commit f7dd8af35e
4 changed files with 13 additions and 7 deletions

View File

@ -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;
}
}

View File

@ -87,7 +87,8 @@ public class Buy extends Command {
checkTrue(!plot.isOwner(player.getUUID()), TranslatableCaption.of("economy.cannot_buy_own"));
Set<Plot> 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"));

View File

@ -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)));
}
}

View File

@ -208,7 +208,7 @@
"permission.no_permission": "<prefix><red>You are lacking the permission node: <gold><node></gold>.</red>",
"permission.no_permission_event": "<prefix><red>You are lacking the permission node: <gold><node></gold>.</red>",
"permission.no_plot_perms": "<prefix><red>You must be the plot owner to perform this action.</red>",
"permission.cant_claim_more_plots": "<prefix><red>You can't claim more plots.</red>",
"permission.cant_claim_more_plots": "<prefix><red>You can't claim more than <gold><amount> </gold>plots.</red>",
"permission.cant_claim_more_clusters": "<prefix><red>You can't claim more clusters.</red>",
"permission.cant_transfer_more_plots": "<prefix><red>You can't send more plots to that user.</red>",
"permission.cant_claim_more_plots_num": "<prefix><red>You can't claim more than <gold><amount> </gold>plots at once.</red>",