Paper/Spigot-API-Patches/0162-Make-the-default-permission-message-configurable.patch

58 Zeilen
2.5 KiB
Diff

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
index 6b619b85fee86ccc599cb46d789e39b81af3201c..dcaefdaf5a0de8486f59115c8c4d4c211b7d64cd 100644
--- 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
index c642fe9cfae6407404f5cf17264f42ef83a01280..9b8e6b7bbbed44e2659379c8046acaa35aaa8910 100644
--- 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
index 7c80dc54776d0d66f7816b77136f6dbd9b801704..c10fc8d2386301bc2caddcdb1cd18566bcaa8689 100644
--- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java
@@ -185,7 +185,7 @@ public abstract class Command {
}
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(Bukkit.getPermissionMessage()); // Paper
} else if (permissionMessage.length() != 0) {
for (String line : permissionMessage.replace("<permission>", permission).split("\n")) {
target.sendMessage(line);