Permission message upgrades (#5932)

* Permission message upgrades

* Allow for blank lines after split

* the future is now :o
This commit is contained in:
BillyGalbreath 2021-06-21 09:07:21 -05:00 committed by GitHub
parent 47605b8e60
commit 1cc41d01ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -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>", permission).split("\n")) {
target.sendMessage(line);
}