diff --git a/README.md b/README.md index fd3c91c..b17339c 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ won't be changed unless the player passes all world protection checks. ## Permissions -| Permission | Description | -|-----------------------|-----------------------------------------| -| placeholdersigns.edit | Allows the use of the /editSign command | \ No newline at end of file +| Permission | Description | +|------------------------------|---------------------------------------------------------------------------------------------------------------| +| placeholdersigns.* | Gives all permissions. | +| placeholdersigns.edit | Allows the use of the /editSign command. | +| placeholdersigns.placeholder | Allows a player to make signs containing placeholders. Without this, placeholders are treated as normal text. | \ No newline at end of file diff --git a/src/main/java/net/knarcraft/placeholdersigns/listener/SignTextListener.java b/src/main/java/net/knarcraft/placeholdersigns/listener/SignTextListener.java index 38dc772..4a988f0 100644 --- a/src/main/java/net/knarcraft/placeholdersigns/listener/SignTextListener.java +++ b/src/main/java/net/knarcraft/placeholdersigns/listener/SignTextListener.java @@ -20,6 +20,11 @@ public class SignTextListener implements Listener { @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onSignCreate(SignChangeEvent event) { + // Only check for placeholders if the player is allowed to + if (!event.getPlayer().hasPermission("placeholdersigns.placeholder")) { + return; + } + String[] lines = event.getLines(); Map placeholders = new HashMap<>(); @@ -37,8 +42,8 @@ public class SignTextListener implements Listener { PlaceholderSignHandler signHandler = PlaceholderSigns.getInstance().getSignHandler(); PlaceholderSign existingSign = signHandler.getFromLocation(location); - // Register the placeholder sign if (!placeholders.isEmpty() && existingSign == null) { + // Register a new placeholder sign PlaceholderSign placeholderSign = new PlaceholderSign(event.getBlock().getLocation(), placeholders); signHandler.registerSign(placeholderSign); } else if (!placeholders.isEmpty()) { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 3144b03..e19e7d5 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -12,6 +12,14 @@ commands: description: Changes the line of a sign without a text limit permissions: + placeholdersigns.*: + children: + - placeholdersigns.edit + - placeholdersigns.placeholder + default: op placeholdersigns.edit: description: Allows a player to use the /editSign command - default: op \ No newline at end of file + default: false + placeholdersigns.placeholder: + description: Allows a player to make signs containing placeholders + default: false \ No newline at end of file