geforkt von Mirrors/Paper
62 Zeilen
3.0 KiB
Diff
62 Zeilen
3.0 KiB
Diff
From 0000000000000000000000000000000000000000 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 c85fc0cb1c4927fe637f20a4e2499bce7707d633..48d0921a9d2dccadbd9510543b24afc5ceff88e3 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -1924,6 +1924,15 @@ public final class Bukkit {
|
|
return server.suggestPlayerNamesWhenNullTabCompletions();
|
|
}
|
|
|
|
+ /**
|
|
+ *
|
|
+ * @return the default no permission message used on the server
|
|
+ */
|
|
+ @NotNull
|
|
+ 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 1a80dad1fa0bf3f33f5669f846912092132f8d64..3659a487c1fa3deb9bcfb7de3733ce0c47704f14 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1691,6 +1691,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
|
*/
|
|
boolean suggestPlayerNamesWhenNullTabCompletions();
|
|
|
|
+ /**
|
|
+ *
|
|
+ * @return the default no permission message used on the server
|
|
+ */
|
|
+ @NotNull
|
|
+ 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 b1152f4dede61383232cc6713d448840612eac13..95847fcb1ac2e430ee192f4f7ac94e981151c5db 100644
|
|
--- a/src/main/java/org/bukkit/command/Command.java
|
|
+++ b/src/main/java/org/bukkit/command/Command.java
|
|
@@ -184,10 +184,9 @@ public abstract class Command {
|
|
return true;
|
|
}
|
|
|
|
- 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 a mistake.");
|
|
// Paper start - use components for permissionMessage
|
|
- } else if (!permissionMessage.equals(net.kyori.adventure.text.Component.empty())) {
|
|
+ net.kyori.adventure.text.Component permissionMessage = this.permissionMessage != null ? this.permissionMessage : io.papermc.paper.text.PaperComponents.legacySectionSerializer().deserialize(Bukkit.getPermissionMessage());
|
|
+ if (!permissionMessage.equals(net.kyori.adventure.text.Component.empty())) {
|
|
target.sendMessage(permissionMessage.replaceText(net.kyori.adventure.text.TextReplacementConfig.builder().matchLiteral("<permission>").replacement(permission).build()));
|
|
// Paper end
|
|
}
|