From 1cc41d01ba69c6c25d0a74a13a2c654818640930 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Mon, 21 Jun 2021 09:07:21 -0500 Subject: [PATCH] Permission message upgrades (#5932) * Permission message upgrades * Allow for blank lines after split * the future is now :o --- ...fault-permission-message-configurable.patch | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/patches/api/0163-Make-the-default-permission-message-configurable.patch b/patches/api/0163-Make-the-default-permission-message-configurable.patch index 3e6d0ea9cd..7f1a66054f 100644 --- a/patches/api/0163-Make-the-default-permission-message-configurable.patch +++ b/patches/api/0163-Make-the-default-permission-message-configurable.patch @@ -43,20 +43,20 @@ index ca4e2d3b27f629e0d5e672fc915a5d03f0c0581d..17f8dd9870a47227a7c9bb09cceedb94 * Creates a PlayerProfile for the specified uuid, with name as null * @param uuid UUID to create profile for diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index 7c80dc54776d0d66f7816b77136f6dbd9b801704..1994f15831de1ca1bb7b4f52c23567825766d3f9 100644 +index 7c80dc54776d0d66f7816b77136f6dbd9b801704..fed7281a912ea256f4b0cb1a5880ac4494a53c18 100644 --- a/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java -@@ -185,7 +185,12 @@ public abstract class Command { +@@ -184,9 +184,10 @@ public abstract class Command { + return true; } - if (permissionMessage == null) { +- if (permissionMessage == null) { - target.sendMessage(ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is a mistake."); -+ // Paper start -+ String bukkitPermissionMessage = Bukkit.getPermissionMessage(); -+ if (org.apache.commons.lang.StringUtils.isNotBlank(bukkitPermissionMessage)) { -+ target.sendMessage(bukkitPermissionMessage); -+ } +- } else if (permissionMessage.length() != 0) { ++ // Paper start ++ String permissionMessage = this.permissionMessage != null ? this.permissionMessage : Bukkit.getPermissionMessage(); ++ if (!permissionMessage.isBlank()) { + // Paper end - } else if (permissionMessage.length() != 0) { for (String line : permissionMessage.replace("", permission).split("\n")) { target.sendMessage(line); + }