3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Don't use deprecated permission message method

Dieser Commit ist enthalten in:
Jason Penilla 2022-06-09 17:03:05 -07:00
Ursprung 5ac29fcb93
Commit 4a51a54896
2 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -66,7 +66,7 @@ index 2042f4963c53d5a903f0de1fec6a9af3a7b2bba4..475fe51ff7a9f1c1ed5048ea59d6d8ba
* Creates a PlayerProfile for the specified uuid, with name as null.
*
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
index a26df5f6341d22ecd5e71da59b8f091848e627ad..cefaea8e08fe5e92c9ef2e4725d42e33dd3dac69 100644
index a26df5f6341d22ecd5e71da59b8f091848e627ad..608b541aef01f33891a492fff5b8400496832c3a 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 {
@ -77,7 +77,7 @@ index a26df5f6341d22ecd5e71da59b8f091848e627ad..cefaea8e08fe5e92c9ef2e4725d42e33
- 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 : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(Bukkit.getPermissionMessage());
+ net.kyori.adventure.text.Component permissionMessage = this.permissionMessage != null ? this.permissionMessage : Bukkit.permissionMessage();
+ 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

Datei anzeigen

@ -5,7 +5,7 @@ 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 b506cd11b76901827cbe66f46db8df400f7015de..bb8f2a0c9fc1fd9bc50dc82934407e12bbd98276 100644
index b506cd11b76901827cbe66f46db8df400f7015de..13a5062e539f6f43e6fe582318c36302bd6520ee 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -57,7 +57,7 @@ public class PaperCommand extends Command {
@ -13,12 +13,12 @@ index b506cd11b76901827cbe66f46db8df400f7015de..bb8f2a0c9fc1fd9bc50dc82934407e12
private static boolean testPermission(CommandSender commandSender, String permission) {
if (commandSender.hasPermission(BASE_PERM + permission) || commandSender.hasPermission("bukkit.command.paper")) return true;
- 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));
+ commandSender.sendMessage(Bukkit.getPermissionMessage()); // Sorry, kashike
+ commandSender.sendMessage(Bukkit.permissionMessage());
return false;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9a9b6ceab49e78a6b5523825e571186f6f610212..80e508aa9fc9cf41ecfc528086cc9eebde7b5728 100644
index 6a2e65401130ca885864e9952f594237d089769d..62fb88baefcf22a49474ea8362db8f99b7318687 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2586,6 +2586,16 @@ public final class CraftServer implements Server {