2019-03-24 18:16:59 +01:00
From b15f7b990de34ce684599ca6515f879f1a2545b3 Mon Sep 17 00:00:00 2001
2018-11-18 20:54:38 +01: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
2019-03-24 18:16:59 +01:00
index 19fb0e5d..6b0a0906 100644
2018-11-18 20:54:38 +01:00
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
2019-03-20 01:28:15 +01:00
@@ -1589,6 +1589,15 @@ public final class Bukkit {
2018-11-18 20:54:38 +01:00
return server.suggestPlayerNamesWhenNullTabCompletions();
}
+ /**
+ *
+ * @return the default no permission message used on the server
+ */
2019-03-20 01:28:15 +01:00
+ @NotNull
2018-11-18 20:54:38 +01: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
2019-03-24 18:16:59 +01:00
index 1df58f72..66d22ba7 100644
2018-11-18 20:54:38 +01:00
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
2019-03-20 01:28:15 +01:00
@@ -1392,6 +1392,13 @@ public interface Server extends PluginMessageRecipient {
2018-11-18 20:54:38 +01:00
*/
boolean suggestPlayerNamesWhenNullTabCompletions();
+ /**
+ *
+ * @return the default no permission message used on the server
+ */
2019-03-20 01:28:15 +01:00
+ @NotNull
2018-11-18 20:54:38 +01: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
2019-03-24 18:16:59 +01:00
index c2c19ed4..f0222fc2 100644
2018-11-18 20:54:38 +01:00
--- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java
2019-03-20 01:28:15 +01:00
@@ -187,7 +187,7 @@ public abstract class Command {
2018-11-18 20:54:38 +01:00
}
if (permissionMessage == null) {
2019-01-15 22:12:19 +01: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-18 20:54:38 +01:00
+ target.sendMessage(Bukkit.getPermissionMessage()); // Paper
} else if (permissionMessage.length() != 0) {
for (String line : permissionMessage.replace("<permission>", permission).split("\n")) {
target.sendMessage(line);
--
2019-03-24 18:16:59 +01:00
2.17.1
2018-11-18 20:54:38 +01:00