5
5
import net .matrixcreations .libraries .utils .LegacyCodeUtils ;
6
6
import net .matrixcreations .libraries .utils .SolidColorUtils ;
7
7
8
- import java .lang .reflect .Method ;
9
- import java .util .Arrays ;
10
8
import java .util .List ;
11
9
import java .util .stream .Collectors ;
12
10
13
11
public final class MatrixColorAPI {
14
12
15
- public static void main (String [] args ) {
16
- logFormatExamples ();
17
- }
18
-
19
13
public static String process (String text ) {
20
14
text = GradientUtils .processGradients (text );
21
15
text = SolidColorUtils .processSolidColors (text );
@@ -26,40 +20,4 @@ public static String process(String text) {
26
20
public static List <String > process (List <String > texts ) {
27
21
return texts .stream ().map (MatrixColorAPI ::process ).collect (Collectors .toList ());
28
22
}
29
-
30
- private static void logFormatExamples () {
31
- List <String > examples = Arrays .asList (
32
- "&#FFD700Normal text" ,
33
- "&#FF0000&lBold red text" ,
34
- "<GRADIENT:#FFD700>Hello this is gradient text</GRADIENT:#FF0000>" ,
35
- "<GRADIENT:#FFD700>&lHello this is bold gradient text</GRADIENT:#FF0000>" ,
36
- "<SOLID:#FFD700>Hello this is solid yellow text" ,
37
- "<SOLID:#FFD700>&lHello this is solid bold yellow text"
38
- );
39
-
40
- // Process and log each format example
41
- ColorUtils .process (examples ).forEach (MatrixColorAPI ::sendConsoleMessage );
42
- }
43
-
44
- public static void sendConsoleMessage (String message ) {
45
- try {
46
- // Load the Bukkit class dynamically (without direct dependency)
47
- Class <?> bukkitClass = Class .forName ("org.bukkit.Bukkit" );
48
-
49
- // Get the getConsoleSender method from Bukkit class
50
- Method getConsoleSenderMethod = bukkitClass .getMethod ("getConsoleSender" );
51
-
52
- // Invoke the method to get the console sender
53
- Object consoleSender = getConsoleSenderMethod .invoke (null );
54
-
55
- // Now find the sendMessage method from the console sender object
56
- Method sendMessageMethod = consoleSender .getClass ().getMethod ("sendMessage" , String .class );
57
-
58
- // Invoke the sendMessage method on the console sender object
59
- sendMessageMethod .invoke (consoleSender , message );
60
-
61
- } catch (Exception e ) {
62
- e .printStackTrace ();
63
- }
64
- }
65
23
}
0 commit comments