mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Handle add & trust permission ranges properly
This commit is contained in:
parent
7898313b0b
commit
eb11d9e3aa
@ -130,11 +130,12 @@ public class Add extends Command {
|
|||||||
size += plot.getTrusted().contains(uuid) ? 0 : 1;
|
size += plot.getTrusted().contains(uuid) ? 0 : 1;
|
||||||
}
|
}
|
||||||
checkTrue(!uuids.isEmpty(), null);
|
checkTrue(!uuids.isEmpty(), null);
|
||||||
|
int localAddSize = plot.getMembers().size();
|
||||||
int maxAddSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_ADD, Settings.Limit.MAX_PLOTS);
|
int maxAddSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_ADD, Settings.Limit.MAX_PLOTS);
|
||||||
if (size > maxAddSize) {
|
if (localAddSize > maxAddSize) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("members.plot_max_members_added"),
|
TranslatableCaption.of("members.plot_max_members_added"),
|
||||||
Template.of("amount", String.valueOf(size - 1))
|
Template.of("amount", String.valueOf(localAddSize))
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -136,11 +136,12 @@ public class Trust extends Command {
|
|||||||
size += currentPlot.getMembers().contains(uuid) ? 0 : 1;
|
size += currentPlot.getMembers().contains(uuid) ? 0 : 1;
|
||||||
}
|
}
|
||||||
checkTrue(!uuids.isEmpty(), null);
|
checkTrue(!uuids.isEmpty(), null);
|
||||||
|
int localTrustSize = currentPlot.getTrusted().size();
|
||||||
int maxTrustSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_TRUST, Settings.Limit.MAX_PLOTS);
|
int maxTrustSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_TRUST, Settings.Limit.MAX_PLOTS);
|
||||||
if (size > maxTrustSize) {
|
if (localTrustSize > maxTrustSize) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("members.plot_max_members_trusted"),
|
TranslatableCaption.of("members.plot_max_members_trusted"),
|
||||||
Template.of("amount", String.valueOf(size - 1))
|
Template.of("amount", String.valueOf(localTrustSize))
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user