diff options
author | Owen <[email protected]> | 2023-02-19 09:57:10 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2023-02-19 08:57:10 -0600 |
commit | 841da90501564e5b430a8469cac6e6a77627725d (patch) | |
tree | 934f58b2dfbf689e502651e4a3ad51383779f4c0 /patches/api/0160-Make-the-default-permission-message-configurable.patch | |
parent | f9dc371fd8c56f1ad1359fc3bf1f7a40921ec66f (diff) | |
download | Paper-841da90501564e5b430a8469cac6e6a77627725d.tar.gz Paper-841da90501564e5b430a8469cac6e6a77627725d.zip |
Paper Plugins (#8108)
Diffstat (limited to 'patches/api/0160-Make-the-default-permission-message-configurable.patch')
-rw-r--r-- | patches/api/0160-Make-the-default-permission-message-configurable.patch | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/patches/api/0160-Make-the-default-permission-message-configurable.patch b/patches/api/0160-Make-the-default-permission-message-configurable.patch new file mode 100644 index 0000000000..2895285fe4 --- /dev/null +++ b/patches/api/0160-Make-the-default-permission-message-configurable.patch @@ -0,0 +1,84 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder <[email protected]> +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 6567da9e9c89f1995b9c3544b4dd767d66e6f5f2..c59700bcec0938bd5a0f10c4e0d5e3e2c446d622 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -2195,6 +2195,28 @@ public final class Bukkit { + return server.suggestPlayerNamesWhenNullTabCompletions(); + } + ++ /** ++ * Gets the default no permission message used on the server ++ * ++ * @return the default message ++ * @deprecated use {@link #permissionMessage()} ++ */ ++ @NotNull ++ @Deprecated ++ public static String getPermissionMessage() { ++ return server.getPermissionMessage(); ++ } ++ ++ /** ++ * Gets the default no permission message used on the server ++ * ++ * @return the default message ++ */ ++ @NotNull ++ public static net.kyori.adventure.text.Component permissionMessage() { ++ return server.permissionMessage(); ++ } ++ + /** + * Creates a PlayerProfile for the specified uuid, with name as null. + * +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index c46cae77e6a1d3f01b08ff03407eb1a564d000de..7e51025404bdc64e5eff48423280ad53244c6631 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -1907,6 +1907,23 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + */ + boolean suggestPlayerNamesWhenNullTabCompletions(); + ++ /** ++ * Gets the default no permission message used on the server ++ * ++ * @return the default message ++ * @deprecated use {@link #permissionMessage()} ++ */ ++ @NotNull ++ @Deprecated ++ String getPermissionMessage(); ++ ++ /** ++ * Gets the default no permission message used on the server ++ * ++ * @return the default message ++ */ ++ @NotNull net.kyori.adventure.text.Component permissionMessage(); ++ + /** + * Creates a PlayerProfile for the specified uuid, with name as null. + * +diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java +index a26df5f6341d22ecd5e71da59b8f091848e627ad..608b541aef01f33891a492fff5b8400496832c3a 100644 +--- a/src/main/java/org/bukkit/command/Command.java ++++ b/src/main/java/org/bukkit/command/Command.java +@@ -184,10 +184,9 @@ public abstract class Command { + return true; + } + +- 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."); + // Paper start - use components for permissionMessage +- } else if (!permissionMessage.equals(net.kyori.adventure.text.Component.empty())) { ++ net.kyori.adventure.text.Component permissionMessage = this.permissionMessage != null ? this.permissionMessage : Bukkit.permissionMessage(); ++ if (!permissionMessage.equals(net.kyori.adventure.text.Component.empty())) { + target.sendMessage(permissionMessage.replaceText(net.kyori.adventure.text.TextReplacementConfig.builder().matchLiteral("<permission>").replacement(permission).build())); + // Paper end + } |