2020-05-06 17:48:49 +08:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2018-11-19 03:54:38 +08:00
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
2020-05-06 17:48:49 +08:00
index f5fac807cce22819cba5878a6e2664f0f82f1ae3..e83f0852d187524a0068a81875323b01e3fd5cbd 100644
2018-11-19 03:54:38 +08:00
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
2020-03-10 19:01:15 +08:00
@@ -1615,6 +1615,15 @@ public final class Bukkit {
2018-11-19 03:54:38 +08:00
return server.suggestPlayerNamesWhenNullTabCompletions();
}
+ /**
+ *
+ * @return the default no permission message used on the server
+ */
2019-03-20 08:28:15 +08:00
+ @NotNull
2018-11-19 03:54:38 +08:00
+ 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
2020-05-06 17:48:49 +08:00
index 11fffc514ed1f0b00b09c0cdb5272ea79340972c..fa855cacec894a0efb254e8a9729a9787464f17d 100644
2018-11-19 03:54:38 +08:00
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
2020-03-10 19:01:15 +08:00
@@ -1414,6 +1414,13 @@ public interface Server extends PluginMessageRecipient {
2018-11-19 03:54:38 +08:00
*/
boolean suggestPlayerNamesWhenNullTabCompletions();
+ /**
+ *
+ * @return the default no permission message used on the server
+ */
2019-03-20 08:28:15 +08:00
+ @NotNull
2018-11-19 03:54:38 +08:00
+ 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
2020-05-06 17:48:49 +08:00
index 03bdc1622791e1206406c87065978688d602e39e..0b0d1bd7c4d5ca5241561211e86a9d1acf1893d2 100644
2018-11-19 03:54:38 +08:00
--- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java
2019-04-23 12:47:07 +08:00
@@ -185,7 +185,7 @@ public abstract class Command {
2018-11-19 03:54:38 +08:00
}
if (permissionMessage == null) {
2019-01-16 05:12:19 +08: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.");
2018-11-19 03:54:38 +08:00
+ target.sendMessage(Bukkit.getPermissionMessage()); // Paper
} else if (permissionMessage.length() != 0) {
for (String line : permissionMessage.replace("<permission>", permission).split("\n")) {
target.sendMessage(line);