2021-06-11 12:02:28 +00:00
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
2021-08-25 20:34:15 +00:00
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
2022-06-03 04:26:56 +00:00
index 0c7738412ce5c9b8c66e3f1c1e13fcd2a2154195..d20fd81524518459635c1b78770de087ad178743 100644
2021-08-25 20:34:15 +00:00
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
2022-06-03 04:26:56 +00:00
@@ -56,7 +56,7 @@ public class PaperCommand extends Command {
2021-08-25 20:34:15 +00:00
private static boolean testPermission(CommandSender commandSender, String permission) {
if (commandSender.hasPermission(BASE_PERM + permission) || commandSender.hasPermission("bukkit.command.paper")) return true;
2022-06-03 04:26:56 +00:00
- commandSender.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));
2021-08-25 20:34:15 +00:00
+ commandSender.sendMessage(Bukkit.getPermissionMessage()); // Sorry, kashike
return false;
}
2021-06-11 12:02:28 +00:00
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
2022-06-03 04:26:56 +00:00
index 65df47283afc4aa1453fdd18e65e6f8cb3bd0c3f..80306b595b555d4057975a07872084a83abe78ae 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
2021-06-13 08:26:58 +00:00
@@ -20,6 +20,7 @@ import java.util.regex.Pattern;
2021-06-11 12:02:28 +00:00
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;
2021-11-09 07:59:15 +00:00
@@ -300,6 +301,11 @@ public class PaperConfig {
2021-06-11 12:02:28 +00:00
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
2022-06-03 04:26:56 +00:00
index b0f7f44569f119d9e16bc468124b69244c61bf87..04457c57b971ef16b202768c26f6e98fe9b1602f 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2022-06-03 04:42:00 +00:00
@@ -2606,6 +2606,11 @@ public final class CraftServer implements Server {
2021-06-11 12:02:28 +00:00
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);