Skip to content

Commit

Permalink
2nd Attempt at fixing #34
Browse files Browse the repository at this point in the history
  • Loading branch information
Refrac committed May 25, 2024
1 parent f306301 commit 47347ea
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion SimpleStaffChat-Bungee/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>me.refracdevelopment</groupId>
<artifactId>SimpleStaffChat</artifactId>
<version>4.3.1</version>
<version>4.3.2</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion SimpleStaffChat-Spigot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>me.refracdevelopment</groupId>
<artifactId>SimpleStaffChat</artifactId>
<version>4.3.1</version>
<version>4.3.2</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -199,8 +206,6 @@ public static void sendPlayer(Player player, @NotNull List<String> 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 {
Expand All @@ -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 {
Expand All @@ -234,8 +237,6 @@ public static void sendSender(@NotNull CommandSender sender, @NotNull String...
*/
public static void sendSender(@NotNull CommandSender sender, @NotNull List<String> messages) {
for (String message : messages) {
message = Placeholders.setPlaceholders(sender, message);

if (getAudiences() != null) {
getAudiences().sender(sender).sendMessage(translate(message));
} else {
Expand Down
2 changes: 1 addition & 1 deletion SimpleStaffChat-Velocity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>me.refracdevelopment</groupId>
<artifactId>SimpleStaffChat</artifactId>
<version>4.3.1</version>
<version>4.3.2</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.refracdevelopment</groupId>
<artifactId>SimpleStaffChat</artifactId>
<version>4.3.1</version>
<version>4.3.2</version>
<packaging>pom</packaging>

<name>SimpleStaffChat</name>
Expand Down

0 comments on commit 47347ea

Please sign in to comment.