From e32e37b2466a96499f730a53644bc7b8aac9de89 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sun, 10 Jul 2022 15:26:20 +0200 Subject: [PATCH] Adds the ability to use \_ as a replacement for spaces between words in the description --- README.md | 7 ++++--- .../knarcraft/permissionsigns/command/CreateCommand.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 28d4410..01c31c3 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,10 @@ permanently by another cause) when they expire. /ps create - Creates a new permission sign. The name is used to describe what the permission sign does, and is displayed on the sign. The description is used to describe what -the permission sign does, but without any limit on the length. The permission,permission is the list of comma-separated -permissions the permission sign will grant to the using player. The cost is the cost to use the permission sign. The -duration is the number of seconds the player should keep the permission for. Use 0 for permanent. +the permission sign does, but without any limit on the length (use "\_" between words, like: This\_is\_a\_sentence). The +permission,permission is the list of comma-separated permissions the permission sign will grant to the using player. The +cost is the cost to use the permission sign. The duration is the number of seconds the player should keep the permission +for. Use 0 for permanent. #### The create command permission list diff --git a/src/main/java/net/knarcraft/permissionsigns/command/CreateCommand.java b/src/main/java/net/knarcraft/permissionsigns/command/CreateCommand.java index 41afdaf..88a087a 100644 --- a/src/main/java/net/knarcraft/permissionsigns/command/CreateCommand.java +++ b/src/main/java/net/knarcraft/permissionsigns/command/CreateCommand.java @@ -57,7 +57,7 @@ public class CreateCommand implements CommandExecutor { */ private PermissionSign parseSign(@NotNull CommandSender sender, @NotNull String[] args) { String name = args[0]; - String description = args[1]; + String description = args[1].replaceAll("\\\\_", " "); String[] permissions = args[2].replaceAll("\\?", " ").split(","); for (String permission : permissions) { if (permission.contains(":")) {