From f944b0b8d6f86e6c3a2b90e0c9237feae61ef611 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 18 Nov 2018 19:49:56 +0000 Subject: [PATCH] Make the default permission message configurable --- .../java/io/papermc/paper/command/PaperCommand.java | 2 +- .../main/java/org/bukkit/craftbukkit/CraftServer.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/io/papermc/paper/command/PaperCommand.java b/paper-server/src/main/java/io/papermc/paper/command/PaperCommand.java index 5b070d1587..e1820a3394 100644 --- a/paper-server/src/main/java/io/papermc/paper/command/PaperCommand.java +++ b/paper-server/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/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 65856f97a5..aebf3eb257 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2900,6 +2900,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);