Skip to content

Commit

Permalink
Remove debug message
Browse files Browse the repository at this point in the history
  • Loading branch information
PikaMug committed May 11, 2021
1 parent 24d4f58 commit 541e6d1
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/main/java/me/pikamug/localelib/LocaleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public boolean sendMessage(final Player player, final String message, final Mate
for (final String lk : lvlKeys) {
msg = msg.replaceFirst("<level>", translate(msg, lk, "<level>"));
}
System.out.println("tellraw " + player.getName() + " [\"" + msg + "\"]");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + player.getName() + " [\"" + msg + "\"]");
return true;
}
Expand Down Expand Up @@ -335,12 +334,11 @@ public String toServerLocale(final String key) throws IllegalAccessException, In
* @return the text to replace the placeholder in the message
*/
private String translate(String message, String key, String placeholder){

String replacement = "\",{\"translate\":\"" + key + "\"";
// Get the text before the placeholder
String text = message.split(placeholder)[0];
// If the text before the placeholder uses any color code
if(text.contains("§")){
if (text.contains("§")) {
// Get the color code that apply on the text and remove §, so we can get the color name later
String colorCode = ChatColor.getLastColors(text).replace("§", "");
// Get the color name
Expand All @@ -349,7 +347,6 @@ private String translate(String message, String key, String placeholder){
// Add the color
replacement += ", \"color\":\"" + colorName.toLowerCase() + "\"";
}

replacement += "},\"";

return replacement;
Expand Down

0 comments on commit 541e6d1

Please sign in to comment.