Don't use deprecated permission message method

This commit is contained in:
Jason Penilla 2022-06-09 17:03:05 -07:00
parent 9f383d8097
commit 7997ea59e0
2 changed files with 2 additions and 2 deletions

View File

@ -77,7 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- 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

View File

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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;
}