Paper/patches/server/0294-Make-the-default-permission-message-configurable.patch
Nassim Jahnke f44d237de9
Updated Upstream (CraftBukkit) (#6504)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
5be41fb8 SPIGOT-6720: Fix bed explosion checks
09b99daf SPIGOT-6722: Close entity manager when unloading world
3a9561bf SPIGOT-6686: Changes in MaximumRepairCost for Anvil Rename cause inconsistency
2021-08-27 11:51:18 +02:00

60 lines
3.3 KiB
Diff

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/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index 1fa190e098079522e0fe3593fa261c1b7ad4e24b..1eb45df9dca5d0c31ac46709e706136a246cb8ea 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -52,7 +52,7 @@ public class PaperCommand extends Command {
private static boolean testPermission(CommandSender commandSender, String permission) {
if (commandSender.hasPermission(BASE_PERM + permission) || commandSender.hasPermission("bukkit.command.paper")) return true;
- commandSender.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 in error."); // Sorry, kashike
+ commandSender.sendMessage(Bukkit.getPermissionMessage()); // Sorry, kashike
return false;
}
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index cdec195a7aab9195c07ebfbba4f25b27a319ca6e..26de4e9daf0826b97a5f12304d7691dc815feee8 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -20,6 +20,7 @@ import java.util.regex.Pattern;
import com.google.common.collect.Lists;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
@@ -297,6 +298,11 @@ public class PaperConfig {
connectionThrottleKickMessage = getString("messages.kick.connection-throttle", connectionThrottleKickMessage);
}
+ public static String noPermissionMessage = "&cI'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.";
+ private static void noPermissionMessage() {
+ noPermissionMessage = ChatColor.translateAlternateColorCodes('&', getString("messages.no-permission", noPermissionMessage));
+ }
+
private static void savePlayerData() {
Object val = config.get("settings.save-player-data");
if (val instanceof Boolean) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d64bcc0aafb918e82e881f6503ce8311e78a3f6f..0d2f6680af8a678b4b07a6a3ba809128c69563e7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2483,6 +2483,11 @@ public final class CraftServer implements Server {
return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions;
}
+ @Override
+ public String getPermissionMessage() {
+ return com.destroystokyo.paper.PaperConfig.noPermissionMessage;
+ }
+
@Override
public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull UUID uuid) {
return createProfile(uuid, null);