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
parent 58c3edcb08
commit 5166ece434

View file

@ -47,16 +47,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/command/Command.java --- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java
@@ -0,0 +0,0 @@ public abstract class Command { @@ -0,0 +0,0 @@ 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."); - 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.");
- } else if (permissionMessage.length() != 0) {
+ // Paper start + // Paper start
+ String bukkitPermissionMessage = Bukkit.getPermissionMessage(); + String permissionMessage = this.permissionMessage != null ? this.permissionMessage : Bukkit.getPermissionMessage();
+ if (org.apache.commons.lang.StringUtils.isNotBlank(bukkitPermissionMessage)) { + if (!permissionMessage.isBlank()) {
+ target.sendMessage(bukkitPermissionMessage);
+ }
+ // Paper end + // Paper end
} else if (permissionMessage.length() != 0) {
for (String line : permissionMessage.replace("<permission>", permission).split("\n")) { for (String line : permissionMessage.replace("<permission>", permission).split("\n")) {
target.sendMessage(line); target.sendMessage(line);
}