aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0266-Make-the-default-permission-message-configurable.patch
blob: a1ea906d4dcb2812d1a905566839a47419cd40b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 18 Nov 2018 19:49:56 +0000
Subject: [PATCH] Make the default permission message configurable


diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main/java/io/papermc/paper/command/PaperCommand.java
index 5b070d158760789bbcaa984426a55d20767abe4a..e1820a339452cd3388dd7cbb928c5f58779a77b6 100644
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
@@ -73,7 +73,7 @@ public final class PaperCommand extends Command {
         if (sender.hasPermission(BASE_PERM + permission) || sender.hasPermission("bukkit.command.paper")) {
             return true;
         }
-        sender.sendMessage(text("I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.", RED));
+        sender.sendMessage(Bukkit.permissionMessage());
         return false;
     }
 
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 954b3725d4f702f284cd8712305a3f97fb90b9c1..7407d9f3480e0e44be44c84831864e511dfdebc2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2874,6 +2874,16 @@ public final class CraftServer implements Server {
         return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions;
     }
 
+    @Override
+    public String getPermissionMessage() {
+        return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacyAmpersand().serialize(io.papermc.paper.configuration.GlobalConfiguration.get().messages.noPermission);
+    }
+
+    @Override
+    public net.kyori.adventure.text.Component permissionMessage() {
+        return io.papermc.paper.configuration.GlobalConfiguration.get().messages.noPermission;
+    }
+
     @Override
     public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull UUID uuid) {
         return createProfile(uuid, null);