testserver/Spigot-API-Patches/0164-Make-the-default-permi...

61 lines
2.3 KiB
Diff
Raw Normal View History

From cee1e4c0473f12e2dc86ddefed433fb92443be5c 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 0c519c41..2148a3c2 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
2019-05-14 02:20:58 +00:00
@@ -1557,6 +1557,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 8a76df52..1cbb9bc6 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
2019-05-14 02:20:58 +00:00
@@ -1364,6 +1364,13 @@ public interface Server extends PluginMessageRecipient {
*/
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 03bdc162..0b0d1bd7 100644
--- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java
2019-04-23 04:47:07 +00:00
@@ -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);
--
2.25.0.windows.1