From 4ff50525ed83c1d6103ee9a60b715968719bb77f Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Fri, 4 Dec 2020 17:30:11 +0100 Subject: [PATCH] Fixes https://github.com/IntellectualSites/PlotSquaredSuggestions/issues/110 --- Bukkit/src/main/resources/plugin.yml | 2 ++ Core/src/main/java/com/plotsquared/core/command/Add.java | 4 ++-- .../src/main/java/com/plotsquared/core/command/Deny.java | 5 +++++ .../main/java/com/plotsquared/core/command/Download.java | 2 +- .../main/java/com/plotsquared/core/command/Trust.java | 5 ++--- .../com/plotsquared/core/permissions/Permission.java | 1 + Core/src/main/resources/lang/messages_en.json | 9 +++++---- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index fc926be42..befc8c077 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -278,6 +278,8 @@ permissions: default: false plots.admin.command.trust: default: false + plots.admin.command.add: + default: false plots.admin.info.force: default: false plots.admin.command.schematic: 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 836ed2d11..19f290c55 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Add.java +++ b/Core/src/main/java/com/plotsquared/core/command/Add.java @@ -114,8 +114,8 @@ public class Add extends Command { size += plot.getTrusted().contains(uuid) ? 0 : 1; } checkTrue(!uuids.isEmpty(), null); - checkTrue(size <= plot.getArea().getMaxPlotMembers() || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST), - TranslatableCaption.of("members.plot_max_members")); + 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))); // Success confirm.run(this, () -> { for (UUID uuid : uuids) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Deny.java b/Core/src/main/java/com/plotsquared/core/command/Deny.java index cfe357c42..bb10764e1 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Deny.java +++ b/Core/src/main/java/com/plotsquared/core/command/Deny.java @@ -72,6 +72,8 @@ public class Deny extends SubCommand { Location location = player.getLocation(); Plot plot = location.getPlotAbs(); + final Plot currentPlot = player.getCurrentPlot(); + int size = currentPlot.getDenied().size(); if (plot == null) { player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); return false; @@ -86,6 +88,9 @@ public class Deny extends SubCommand { 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) -> { if (throwable instanceof TimeoutException) { player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); diff --git a/Core/src/main/java/com/plotsquared/core/command/Download.java b/Core/src/main/java/com/plotsquared/core/command/Download.java index ab49b5235..ea5586c4a 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Download.java +++ b/Core/src/main/java/com/plotsquared/core/command/Download.java @@ -51,7 +51,7 @@ import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; -@CommandDeclaration(usage = "/plot download [schematic | world]", +@CommandDeclaration(usage = "/plot download [schem | world]", command = "download", aliases = {"dl"}, category = CommandCategory.SCHEMATIC, 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 965315f5a..a0f92627f 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Trust.java +++ b/Core/src/main/java/com/plotsquared/core/command/Trust.java @@ -128,9 +128,8 @@ public class Trust extends Command { size += currentPlot.getMembers().contains(uuid) ? 0 : 1; } checkTrue(!uuids.isEmpty(), null); - checkTrue(size <= currentPlot.getArea().getMaxPlotMembers() || Permissions - .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST), - TranslatableCaption.of("member.plot_max_members")); + 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))); // 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 7a9faebe0..1a8f0938c 100644 --- a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java +++ b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java @@ -76,6 +76,7 @@ public enum Permission { PERMISSION_ADMIN_INTERACT_OTHER("plots.admin.interact.other"), PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT("plots.admin.build.heightlimit"), 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_EVERYONE("plots.trust.everyone"), PERMISSION_AREA_CREATE("plots.area.create"), diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 81760e176..eac393836 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -352,7 +352,7 @@ "blocklist.block_list_separator": ", ", "biome.need_biome": "You need to specify a valid biome.", - "biome.biome_set_to": "Plot biome set to ", + "biome.biome_set_to": "Plot biome set to . You may have to rejoin your game to see a change.", "teleport.teleported_to_plot": "You have been teleported.", "teleport.teleported_to_road": "You got teleported to the road.", @@ -380,7 +380,7 @@ "info.plot_info_unclaimed": "Plot is not yet claimed.", "info.plot_info_header": "--------- INFO ---------", "info.plot_info_hidden": "You cannot view the information about this plot.", - "info.plot_info_format": "
\nID: \nArea: \nAlias: \nOwner: \nBiome: \nCan Build: \nRating: \nSeen: \nTrusted: \nMembers: \nDenied: \nFlags:\nDescription: \n