From 47347ea7efe998683bcf4094274e87d4d94e4d32 Mon Sep 17 00:00:00 2001 From: Zach Date: Sat, 25 May 2024 17:43:39 -0500 Subject: [PATCH] 2nd Attempt at fixing #34 --- SimpleStaffChat-Bungee/pom.xml | 2 +- SimpleStaffChat-Spigot/pom.xml | 2 +- .../utilities/chat/RyMessageUtils.java | 19 ++++++++++--------- SimpleStaffChat-Velocity/pom.xml | 2 +- pom.xml | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/SimpleStaffChat-Bungee/pom.xml b/SimpleStaffChat-Bungee/pom.xml index dba5d20..808ade1 100644 --- a/SimpleStaffChat-Bungee/pom.xml +++ b/SimpleStaffChat-Bungee/pom.xml @@ -6,7 +6,7 @@ me.refracdevelopment SimpleStaffChat - 4.3.1 + 4.3.2 4.0.0 diff --git a/SimpleStaffChat-Spigot/pom.xml b/SimpleStaffChat-Spigot/pom.xml index 8d4763a..59fb6a8 100644 --- a/SimpleStaffChat-Spigot/pom.xml +++ b/SimpleStaffChat-Spigot/pom.xml @@ -6,7 +6,7 @@ me.refracdevelopment SimpleStaffChat - 4.3.1 + 4.3.2 4.0.0 diff --git a/SimpleStaffChat-Spigot/src/main/java/me/refracdevelopment/simplestaffchat/utilities/chat/RyMessageUtils.java b/SimpleStaffChat-Spigot/src/main/java/me/refracdevelopment/simplestaffchat/utilities/chat/RyMessageUtils.java index bfdf1df..caa21a9 100644 --- a/SimpleStaffChat-Spigot/src/main/java/me/refracdevelopment/simplestaffchat/utilities/chat/RyMessageUtils.java +++ b/SimpleStaffChat-Spigot/src/main/java/me/refracdevelopment/simplestaffchat/utilities/chat/RyMessageUtils.java @@ -93,9 +93,9 @@ public static Component translate(Player player, String message) { message = Placeholders.setPlaceholders(player, message); if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) { - String PAPI = PlaceholderAPI.setPlaceholders(player, message); + message = PlaceholderAPI.setPlaceholders(player, message); - return translate(PAPI); + return translate(message); } return translate(message); @@ -115,7 +115,14 @@ public static Component translate(String message) { return component; } - // Taken from https://github.com/EternalCodeTeam/ChatFormatter/ + /** + * Translate a string from legacy to Adventure API. + * + * @param input The string that needs translating. + * @return String which is in an adventure format. + * + * @Author: EternalCodeTeam (https://github.com/EternalCodeTeam/ChatFormatter/) + */ private static String legacyToAdventure(String input) { String result = HEX_PATTERN.matcher(input).replaceAll(matchResult -> { String hex = matchResult.group(1); @@ -199,8 +206,6 @@ public static void sendPlayer(Player player, @NotNull List messages) { * @param message The message you wish to send to the sender. */ public static void sendSender(@NotNull CommandSender sender, @NotNull String message) { - message = Placeholders.setPlaceholders(sender, message); - if (getAudiences() != null) { getAudiences().sender(sender).sendMessage(translate(message)); } else { @@ -216,8 +221,6 @@ public static void sendSender(@NotNull CommandSender sender, @NotNull String mes */ public static void sendSender(@NotNull CommandSender sender, @NotNull String... messages) { for (String message : messages) { - message = Placeholders.setPlaceholders(sender, message); - if (getAudiences() != null) { getAudiences().sender(sender).sendMessage(translate(message)); } else { @@ -234,8 +237,6 @@ public static void sendSender(@NotNull CommandSender sender, @NotNull String... */ public static void sendSender(@NotNull CommandSender sender, @NotNull List messages) { for (String message : messages) { - message = Placeholders.setPlaceholders(sender, message); - if (getAudiences() != null) { getAudiences().sender(sender).sendMessage(translate(message)); } else { diff --git a/SimpleStaffChat-Velocity/pom.xml b/SimpleStaffChat-Velocity/pom.xml index 7677eca..3b3fab8 100644 --- a/SimpleStaffChat-Velocity/pom.xml +++ b/SimpleStaffChat-Velocity/pom.xml @@ -6,7 +6,7 @@ me.refracdevelopment SimpleStaffChat - 4.3.1 + 4.3.2 4.0.0 diff --git a/pom.xml b/pom.xml index a5b8fd7..218e083 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.refracdevelopment SimpleStaffChat - 4.3.1 + 4.3.2 pom SimpleStaffChat