diff --git a/Core/src/main/java/com/plotsquared/core/command/Add.java b/Core/src/main/java/com/plotsquared/core/command/Add.java index 19f290c55..257ee7897 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Add.java +++ b/Core/src/main/java/com/plotsquared/core/command/Add.java @@ -26,6 +26,7 @@ package com.plotsquared.core.command; import com.google.inject.Inject; +import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.permissions.Permission; import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.database.DBFunc; @@ -114,8 +115,11 @@ public class Add extends Command { size += plot.getTrusted().contains(uuid) ? 0 : 1; } checkTrue(!uuids.isEmpty(), null); - if (!(player.hasPermission("plots.add." + size) || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_ADD))) - player.sendMessage(TranslatableCaption.of("members.plot_max_members"), Template.of("amount", String.valueOf(size - 1))); + int maxAddSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_ADD, Settings.Limit.MAX_PLOTS); + if (size > maxAddSize) { + player.sendMessage(TranslatableCaption.of("members.plot_max_members_added"), Template.of("amount", String.valueOf(size - 1))); + return; + } // Success confirm.run(this, () -> { for (UUID uuid : uuids) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Trust.java b/Core/src/main/java/com/plotsquared/core/command/Trust.java index a0f92627f..0afdfc33c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Trust.java +++ b/Core/src/main/java/com/plotsquared/core/command/Trust.java @@ -26,6 +26,7 @@ package com.plotsquared.core.command; import com.google.inject.Inject; +import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.permissions.Permission; import com.plotsquared.core.configuration.caption.Templates; import com.plotsquared.core.configuration.caption.TranslatableCaption; @@ -128,8 +129,11 @@ public class Trust extends Command { size += currentPlot.getMembers().contains(uuid) ? 0 : 1; } checkTrue(!uuids.isEmpty(), null); - if (!(player.hasPermission("plots.trust." + size) || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) - player.sendMessage(TranslatableCaption.of("members.plot_max_members"), Template.of("amount", String.valueOf(size - 1))); + int maxTrustSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_TRUST, Settings.Limit.MAX_PLOTS); + if (size > maxTrustSize) { + player.sendMessage(TranslatableCaption.of("members.plot_max_members_trusted"), Template.of("amount", String.valueOf(size - 1))); + return; + } // Success confirm.run(this, () -> { for (UUID uuid : uuids) { diff --git a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java index 1a8f0938c..e4a6927a1 100644 --- a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java +++ b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java @@ -78,6 +78,8 @@ public enum Permission { PERMISSION_ADMIN_COMMAND_PURGE_RATINGS("plots.admin.command.purge.ratings"), PERMISSION_ADMIN_COMMAND_ADD("plots.admin.command.trust"), PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust"), + PERMISSION_TRUST("plots.trust"), + PERMISSION_ADD("plots.add"), PERMISSION_TRUST_EVERYONE("plots.trust.everyone"), PERMISSION_AREA_CREATE("plots.area.create"), PERMISSION_AREA_INFO("plots.area.info"), diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 36bdc1f42..6b3bd8a52 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -452,7 +452,8 @@ "member.already_owner": " is already the plot owner.", "member.already_added": "That user is already added to that category: ", "member.member_added": "That user can now build while the plot owner is online.", - "members.plot_max_members": "You are not allowed to add more than players to this plot.", + "members.plot_max_members_added": "You are not allowed to add more than players to this plot.", + "members.plot_max_members_trusted": "You are not allowed to trust more than players to this plot.", "members.plot_max_members_denied": "You are not allowed to deny more than players from this plot.", "members.not_added_trusted": "You must be added or trusted to the plot to run that command.",