Handle add & trust permission ranges properly

This commit is contained in:
NotMyFault 2021-06-28 16:40:01 +02:00
parent 7898313b0b
commit eb11d9e3aa
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 6 additions and 4 deletions

View File

@ -130,11 +130,12 @@ public class Add extends Command {
size += plot.getTrusted().contains(uuid) ? 0 : 1;
}
checkTrue(!uuids.isEmpty(), null);
int localAddSize = plot.getMembers().size();
int maxAddSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_ADD, Settings.Limit.MAX_PLOTS);
if (size > maxAddSize) {
if (localAddSize > maxAddSize) {
player.sendMessage(
TranslatableCaption.of("members.plot_max_members_added"),
Template.of("amount", String.valueOf(size - 1))
Template.of("amount", String.valueOf(localAddSize))
);
return;
}

View File

@ -136,11 +136,12 @@ public class Trust extends Command {
size += currentPlot.getMembers().contains(uuid) ? 0 : 1;
}
checkTrue(!uuids.isEmpty(), null);
int localTrustSize = currentPlot.getTrusted().size();
int maxTrustSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_TRUST, Settings.Limit.MAX_PLOTS);
if (size > maxTrustSize) {
if (localTrustSize > maxTrustSize) {
player.sendMessage(
TranslatableCaption.of("members.plot_max_members_trusted"),
Template.of("amount", String.valueOf(size - 1))
Template.of("amount", String.valueOf(localTrustSize))
);
return;
}