This commit is contained in:
N0tMyFaultOG 2020-11-03 16:43:48 +01:00
commit 7a203a12a3
4 changed files with 13 additions and 7 deletions

View File

@ -108,10 +108,12 @@ public class Auto extends SubCommand {
if (metaDataAccess.isPresent()) { if (metaDataAccess.isPresent()) {
int grantedPlots = metaDataAccess.get().orElse(0); int grantedPlots = metaDataAccess.get().orElse(0);
if (diff < 0 && grantedPlots < sizeX * sizeZ) { 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; return false;
} else if (diff >= 0 && grantedPlots + diff < sizeX * sizeZ) { } 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; return false;
} else { } else {
int left = grantedPlots + diff < 0 ? 0 : diff - sizeX * sizeZ; int left = grantedPlots + diff < 0 ? 0 : diff - sizeX * sizeZ;
@ -125,7 +127,8 @@ public class Auto extends SubCommand {
Template.of("remainingGrants", String.valueOf(left))); Template.of("remainingGrants", String.valueOf(left)));
} }
} else { } 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; return false;
} }
} }

View File

@ -87,7 +87,8 @@ public class Buy extends Command {
checkTrue(!plot.isOwner(player.getUUID()), TranslatableCaption.of("economy.cannot_buy_own")); checkTrue(!plot.isOwner(player.getUUID()), TranslatableCaption.of("economy.cannot_buy_own"));
Set<Plot> plots = plot.getConnectedPlots(); Set<Plot> plots = plot.getConnectedPlots();
checkTrue(player.getPlotCount() + plots.size() <= player.getAllowedPlots(), 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); double price = plot.getFlag(PriceFlag.class);
if (price <= 0) { if (price <= 0) {
throw new CommandException(TranslatableCaption.of("economy.not_for_sale")); 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); grants = metaDataAccess.get().orElse(0);
if (grants <= 0) { if (grants <= 0) {
metaDataAccess.remove(); 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 { } 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": "<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_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.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_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_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>", "permission.cant_claim_more_plots_num": "<prefix><red>You can't claim more than <gold><amount> </gold>plots at once.</red>",