mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Merge branch 'v6' into feature/v6/generify-perms
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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"));
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,13 @@ public class Visit extends Command {
|
||||
Templates.of("node", "plots.admin.visit.untrusted"));
|
||||
return;
|
||||
}
|
||||
if (plot.isDenied(player.getUUID())) {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_DENIED)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_VISIT_DENIED)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
confirm.run(this, () -> plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {
|
||||
|
@ -157,6 +157,7 @@ public enum Permission {
|
||||
PERMISSION_VISIT_UNOWNED("plots.visit.unowned"),
|
||||
PERMISSION_VISIT_OWNED("plots.visit.owned"),
|
||||
PERMISSION_SHARED("plots.visit.shared"),
|
||||
PERMISSION_VISIT_DENIED("plots.visit.denied"),
|
||||
PERMISSION_VISIT_OTHER("plots.visit.other"),
|
||||
PERMISSION_HOME("plots.home"),
|
||||
PERMISSION_ALIAS_SET("plots.alias.set"),
|
||||
|
@ -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>",
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user