2020-05-06 11:48:49 +02:00
From 0000000000000000000000000000000000000000 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
2020-07-22 10:26:59 +02:00
index 97ed7d9f6415219db4d6b0054dc3d2afeb1ce6e5..c6834080859051bdd0f33f2c9e9a8e48d7dbd31b 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
2020-07-22 10:26:59 +02:00
@@ -1658,6 +1658,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
2020-07-22 10:26:59 +02:00
index da9c85372605ab0d68f21bb38885eb0f4dfebded..47e6a3f2bd41a9a01ec74e4c3f4919098ba88614 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
2020-07-22 10:26:59 +02:00
@@ -1451,6 +1451,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
2020-07-22 10:26:59 +02:00
index 7c80dc54776d0d66f7816b77136f6dbd9b801704..c10fc8d2386301bc2caddcdb1cd18566bcaa8689 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-04-23 06:47:07 +02:00
@@ -185,7 +185,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);