@@ -23,7 +23,15 @@ private Chat() {
2323 throw new IllegalStateException ("Utility class" );
2424 }
2525
26+ public static String translateColorCodes (String text ) {
27+ if (text == null ) {
28+ return null ;
29+ }
30+ return ChatColor .translateAlternateColorCodes ('&' , text );
31+ }
32+
2633 public static void sendComponent (CommandSender sender , String string , String bypass ) {
34+ string = translateColorCodes (string );
2735 SpigotAdapter .ADAPTER .sendComponent (sender , string , bypass );
2836 }
2937
@@ -32,6 +40,7 @@ public static void sendComponent(CommandSender sender, String string) {
3240 }
3341
3442 public static void sendMessage (CommandSender sender , String message ) {
43+ message = translateColorCodes (message );
3544 if (sender instanceof ConsoleCommandSender ) {
3645 message = message .replace (Color .DARK_AQUA , ChatColor .DARK_AQUA .toString ());
3746 }
@@ -40,10 +49,12 @@ public static void sendMessage(CommandSender sender, String message) {
4049 }
4150
4251 public static void sendConsoleMessage (String string ) {
52+ string = translateColorCodes (string );
4353 Bukkit .getServer ().getConsoleSender ().sendMessage (string );
4454 }
4555
4656 public static void console (String string ) {
57+ string = translateColorCodes (string );
4758 if (string .startsWith ("-" ) || string .startsWith ("[" )) {
4859 Bukkit .getLogger ().log (Level .INFO , string );
4960 }
@@ -53,6 +64,7 @@ public static void console(String string) {
5364 }
5465
5566 public static void sendGlobalMessage (CommandSender user , String string ) {
67+ string = translateColorCodes (string );
5668 if (user instanceof ConsoleCommandSender ) {
5769 sendMessage (user , Color .DARK_AQUA + "[CoreProtect] " + Color .WHITE + string );
5870 return ;
0 commit comments