mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
Make the default permission message configurable
This commit is contained in:
parent
b710cc2e82
commit
975491cb8b
2 changed files with 106 additions and 0 deletions
|
@ -0,0 +1,58 @@
|
||||||
|
From f8b5db1f226e671fc1fd422e4723eb8eaa70eddc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Shane Freeder <theboyetronic@gmail.com>
|
||||||
|
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 233a71540..22ca2900c 100644
|
||||||
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
|
@@ -1463,6 +1463,14 @@ public final class Bukkit {
|
||||||
|
return server.suggestPlayerNamesWhenNullTabCompletions();
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /**
|
||||||
|
+ *
|
||||||
|
+ * @return the default no permission message used on the server
|
||||||
|
+ */
|
||||||
|
+ public static String getPermissionMessage() {
|
||||||
|
+ return server.getPermissionMessage();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Creates a PlayerProfile for the specified uuid, with name as null
|
||||||
|
* @param uuid UUID to create profile for
|
||||||
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
|
index b8076fc3f..9c78f18f6 100644
|
||||||
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
|
@@ -1265,6 +1265,12 @@ public interface Server extends PluginMessageRecipient {
|
||||||
|
*/
|
||||||
|
boolean suggestPlayerNamesWhenNullTabCompletions();
|
||||||
|
|
||||||
|
+ /**
|
||||||
|
+ *
|
||||||
|
+ * @return the default no permission message used on the server
|
||||||
|
+ */
|
||||||
|
+ String getPermissionMessage();
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Creates a PlayerProfile for the specified uuid, with name as null
|
||||||
|
* @param uuid UUID to create profile for
|
||||||
|
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
|
||||||
|
index 4a479627d..77171cd17 100644
|
||||||
|
--- a/src/main/java/org/bukkit/command/Command.java
|
||||||
|
+++ b/src/main/java/org/bukkit/command/Command.java
|
||||||
|
@@ -180,7 +180,7 @@ public abstract class Command {
|
||||||
|
}
|
||||||
|
|
||||||
|
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 in error.");
|
||||||
|
+ target.sendMessage(Bukkit.getPermissionMessage()); // Paper
|
||||||
|
} else if (permissionMessage.length() != 0) {
|
||||||
|
for (String line : permissionMessage.replace("<permission>", permission).split("\n")) {
|
||||||
|
target.sendMessage(line);
|
||||||
|
--
|
||||||
|
2.19.1
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
From 83381a58c6d6c970af932bbff81bd7fab6d6316b 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/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
|
index beec4e33c6..579726bb59 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
|
@@ -21,6 +21,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;
|
||||||
|
@@ -311,6 +312,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));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public static boolean savePlayerData = true;
|
||||||
|
private static void savePlayerData() {
|
||||||
|
savePlayerData = getBoolean("settings.save-player-data", savePlayerData);
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
index 648ac4d183..645953a310 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
@@ -2146,6 +2146,10 @@ public final class CraftServer implements Server {
|
||||||
|
return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public String getPermissionMessage() {
|
||||||
|
+ return com.destroystokyo.paper.PaperConfig.noPermissionMessage;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull UUID uuid) {
|
||||||
|
return createProfile(uuid, null);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.19.1
|
||||||
|
|
Loading…
Reference in a new issue