2021-06-11 12:02:28 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 18 Nov 2018 19:44:54 +0000
Subject: [PATCH] Make the default permission message configurable
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
2021-06-13 08:26:58 +00:00
index 1f4532e60abe62b88472a9bb0ef8d1af1f921220..a69e0b0c9f515256c6406ef8ff55f72c98dabe0d 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1793,6 +1793,15 @@ public final class Bukkit {
return server.suggestPlayerNamesWhenNullTabCompletions();
}
+ /**
+ *
+ * @return the default no permission message used on the server
+ */
+ @NotNull
+ public static String getPermissionMessage() {
+ return server.getPermissionMessage();
+ }
+
/**
* 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/Server.java b/src/main/java/org/bukkit/Server.java
2021-06-13 08:26:58 +00:00
index ca4e2d3b27f629e0d5e672fc915a5d03f0c0581d..17f8dd9870a47227a7c9bb09cceedb94f7190ead 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1575,6 +1575,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
boolean suggestPlayerNamesWhenNullTabCompletions();
+ /**
+ *
+ * @return the default no permission message used on the server
+ */
+ @NotNull
+ String getPermissionMessage();
+
/**
* 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
2021-06-21 14:07:21 +00:00
index 7c80dc54776d0d66f7816b77136f6dbd9b801704..fed7281a912ea256f4b0cb1a5880ac4494a53c18 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java
2021-06-21 14:07:21 +00:00
@@ -184,9 +184,10 @@ public abstract class Command {
return true;
2021-06-11 12:02:28 +00:00
}
2021-06-21 14:07:21 +00:00
- if (permissionMessage == null) {
2021-06-11 12:02:28 +00:00
- 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.");
2021-06-21 14:07:21 +00:00
- } else if (permissionMessage.length() != 0) {
+ // Paper start
+ String permissionMessage = this.permissionMessage != null ? this.permissionMessage : Bukkit.getPermissionMessage();
+ if (!permissionMessage.isBlank()) {
2021-06-21 01:50:36 +00:00
+ // Paper end
2021-06-11 12:02:28 +00:00
for (String line : permissionMessage.replace("<permission>", permission).split("\n")) {
target.sendMessage(line);
2021-06-21 14:07:21 +00:00
}