N0tMyFaultOG 2020-12-04 17:30:11 +01:00
parent 34e02e9f3a
commit 4ff50525ed
No known key found for this signature in database
GPG Key ID: 823348042DA95A81
7 changed files with 18 additions and 10 deletions

View File

@ -278,6 +278,8 @@ permissions:
default: false default: false
plots.admin.command.trust: plots.admin.command.trust:
default: false default: false
plots.admin.command.add:
default: false
plots.admin.info.force: plots.admin.info.force:
default: false default: false
plots.admin.command.schematic: plots.admin.command.schematic:

View File

@ -114,8 +114,8 @@ 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);
checkTrue(size <= plot.getArea().getMaxPlotMembers() || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST), if (!(player.hasPermission("plots.add." + size) || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_ADD)))
TranslatableCaption.of("members.plot_max_members")); player.sendMessage(TranslatableCaption.of("members.plot_max_members"), Template.of("amount", String.valueOf(size - 1)));
// Success // Success
confirm.run(this, () -> { confirm.run(this, () -> {
for (UUID uuid : uuids) { for (UUID uuid : uuids) {

View File

@ -72,6 +72,8 @@ public class Deny extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot = location.getPlotAbs(); Plot plot = location.getPlotAbs();
final Plot currentPlot = player.getCurrentPlot();
int size = currentPlot.getDenied().size();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
return false; return false;
@ -86,6 +88,9 @@ public class Deny extends SubCommand {
return true; return true;
} }
if (!(player.hasPermission("plots.deny." + size) || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DENY)))
player.sendMessage(TranslatableCaption.of("members.plot_max_members_denied"), Template.of("amount", String.valueOf(size)));
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> { PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));

View File

@ -51,7 +51,7 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@CommandDeclaration(usage = "/plot download [schematic | world]", @CommandDeclaration(usage = "/plot download [schem | world]",
command = "download", command = "download",
aliases = {"dl"}, aliases = {"dl"},
category = CommandCategory.SCHEMATIC, category = CommandCategory.SCHEMATIC,

View File

@ -128,9 +128,8 @@ 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);
checkTrue(size <= currentPlot.getArea().getMaxPlotMembers() || Permissions if (!(player.hasPermission("plots.trust." + size) || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST)))
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST), player.sendMessage(TranslatableCaption.of("members.plot_max_members"), Template.of("amount", String.valueOf(size - 1)));
TranslatableCaption.of("member.plot_max_members"));
// Success // Success
confirm.run(this, () -> { confirm.run(this, () -> {
for (UUID uuid : uuids) { for (UUID uuid : uuids) {

View File

@ -76,6 +76,7 @@ public enum Permission {
PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other"), PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other"),
PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT("plots.admin.build.heightlimit"), PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT("plots.admin.build.heightlimit"),
PERMISSION_ADMIN_COMMAND_PURGE_RATINGS("plots.admin.command.purge.ratings"), 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_ADMIN_COMMAND_TRUST("plots.admin.command.trust"),
PERMISSION_TRUST_EVERYONE("plots.trust.everyone"), PERMISSION_TRUST_EVERYONE("plots.trust.everyone"),
PERMISSION_AREA_CREATE("plots.area.create"), PERMISSION_AREA_CREATE("plots.area.create"),

View File

@ -352,7 +352,7 @@
"blocklist.block_list_separator": "</gray><gold>,</gold><gray> ", "blocklist.block_list_separator": "</gray><gold>,</gold><gray> ",
"biome.need_biome": "<prefix><red>You need to specify a valid biome.</red>", "biome.need_biome": "<prefix><red>You need to specify a valid biome.</red>",
"biome.biome_set_to": "<prefix><gold>Plot biome set to <gray><value></gray></gold>", "biome.biome_set_to": "<prefix><gold>Plot biome set to <gray><value></gray>. You may have to rejoin your game to see a change.</gold>",
"teleport.teleported_to_plot": "<prefix><gold>You have been teleported.</gold>", "teleport.teleported_to_plot": "<prefix><gold>You have been teleported.</gold>",
"teleport.teleported_to_road": "<prefix><gold>You got teleported to the road.</gold>", "teleport.teleported_to_road": "<prefix><gold>You got teleported to the road.</gold>",
@ -380,7 +380,7 @@
"info.plot_info_unclaimed": "<prefix><gray>Plot <gold><plot></gold> is not yet claimed.</gray>", "info.plot_info_unclaimed": "<prefix><gray>Plot <gold><plot></gold> is not yet claimed.</gray>",
"info.plot_info_header": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------</dark_gray><reset>", "info.plot_info_header": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------</dark_gray><reset>",
"info.plot_info_hidden": "<prefix><red>You cannot view the information about this plot.</red>", "info.plot_info_hidden": "<prefix><red>You cannot view the information about this plot.</red>",
"info.plot_info_format": "<header>\n<gold>ID: <gray><id></gray>\nArea: <gray><area></gray>\nAlias: <gray><alias></gray>\nOwner: <gray><owner></gray>\nBiome: <gray><biome></gray>\nCan Build: <gray><build></gray>\nRating: <gray><rating></gray>\nSeen: <gray><seen></gray>\nTrusted: <gray><trusted></gray>\nMembers: <gray><members></gray>\nDenied: <gray><denied></gray>\nFlags:<gray><flags></gray>\nDescription: <gray><desc></gray></gold>\n<footer>", "info.plot_info_format": "<header>\n<gold>ID: <gray><id></gray>\nArea: <gray><area></gray>\nAlias: <gray><alias></gray>\nOwner: <gray><owner></gray>\nBiome: <gray><biome></gray>\nCan Build: <gray><build></gray>\nRating: <gray><rating></gray>\nSeen: <gray><seen></gray>\nTrusted: <gray><trusted></gray>\nMembers: <gray><members></gray>\nDenied: <gray><denied></gray>\nFlags: <gray><flags></gray>\nDescription: <gray><desc></gray></gold>\n<footer>",
"info.plot_info_footer": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------<reset>", "info.plot_info_footer": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------<reset>",
"info.plot_info_trusted": "<gold>Trusted:</gold> <gray><trusted></gray>", "info.plot_info_trusted": "<gold>Trusted:</gold> <gray><trusted></gray>",
"info.plot_info_members": "<gold>Members:</gold> <gray><members></gray>", "info.plot_info_members": "<gold>Members:</gold> <gray><members></gray>",
@ -445,11 +445,12 @@
"member.removed_players": "<prefix><gray>Removed <amount> player(s) from this plot.</gray>", "member.removed_players": "<prefix><gray>Removed <amount> player(s) from this plot.</gray>",
"member.plot_left": "<prefix><gray><player> left the plot.</gray>", "member.plot_left": "<prefix><gray><player> left the plot.</gray>",
"member.plot_cant_leave_owner": "<prefix><red>You are this plot owner. You cannot leave the plot.</red>", "member.plot_cant_leave_owner": "<prefix><red>You are the plot owner. You cannot leave this plot.</red>",
"member.already_owner": "<prefix><gray><player></gray><gold> is already the plot owner.</gold>", "member.already_owner": "<prefix><gray><player></gray><gold> is already the plot owner.</gold>",
"member.already_added": "<prefix><gray>That user is already added to that category: <player></gray>", "member.already_added": "<prefix><gray>That user is already added to that category: <player></gray>",
"member.member_added": "<prefix><dark_aqua>That user can now build while the plot owner is online.</dark_aqua>", "member.member_added": "<prefix><dark_aqua>That user can now build while the plot owner is online.</dark_aqua>",
"members.plot_max_members": "<prefix><red>You are not allowed to add any more players to this plot.</red>", "members.plot_max_members": "<prefix><red>You are not allowed to add more than </red><gold><amount></gold><red> players to this plot.</red>",
"members.plot_max_members_denied": "<prefix><red>You are not allowed to deny more than </red><gold><amount></gold><red> players from this plot.</red>",
"members.not_added_trusted": "<prefix><red>You must be added or trusted to the plot to run that command.</red>", "members.not_added_trusted": "<prefix><red>You must be added or trusted to the plot to run that command.</red>",
"owner.set_owner": "<prefix><dark_aqua>You successfully set the plot owner.</dark_aqua>", "owner.set_owner": "<prefix><dark_aqua>You successfully set the plot owner.</dark_aqua>",