22
33import com .mojang .brigadier .builder .LiteralArgumentBuilder ;
44import meteordevelopment .meteorclient .commands .Command ;
5- import meteordevelopment .meteorclient .utils .player .ChatUtils ;
65import net .minecraft .command .CommandSource ;
76import net .minecraft .item .ItemStack ;
8- import net .minecraft .text .Text ;
97import net .minecraft .util .Formatting ;
10- import xyz .omegaware .addon .OmegawareAddons ;
118import xyz .omegaware .addon .modules .ItemFrameDupeModule ;
9+ import xyz .omegaware .addon .utils .Logger ;
1210
1311public class ShulkerQueueCommand extends Command {
1412 public ShulkerQueueCommand () {
@@ -19,116 +17,71 @@ public ShulkerQueueCommand() {
1917 public void build (LiteralArgumentBuilder <CommandSource > builder ) {
2018 builder .then (literal ("add" ).executes (context -> {
2119 if (mc .player == null ) {
22- Text msg = OmegawareAddons .PREFIX .copy ()
23- .append (Text .literal ("Error: " ).formatted (Formatting .RED ))
24- .append (Text .literal ("Player was somehow null" ).formatted (Formatting .WHITE ));
25- ChatUtils .sendMsg (msg );
26-
20+ Logger .error ("Player was somehow null" );
2721 return SINGLE_SUCCESS ;
2822 }
2923
3024 ItemStack stack = mc .player .getMainHandStack ();
3125 if (stack .isEmpty ()) {
32- Text msg = OmegawareAddons .PREFIX .copy ()
33- .append (Text .literal ("Error: " ).formatted (Formatting .RED ))
34- .append (Text .literal ("You must hold an item in your main hand" ).formatted (Formatting .WHITE ));
35- ChatUtils .sendMsg (msg );
36-
26+ Logger .error ("You must hold an item in your main hand" );
3727 return SINGLE_SUCCESS ;
3828 }
3929 ItemFrameDupeModule .shulkerQueue .add (stack .copy ());
4030
41- Text msg = OmegawareAddons .PREFIX .copy ()
42- .append (Text .literal ("Added " ).formatted (Formatting .GREEN ))
43- .append (stack .toHoverableText ())
44- .append (Text .literal (" to the shulker queue" ).formatted (Formatting .WHITE ));
45- ChatUtils .sendMsg (msg );
31+ Logger .info ("%sAdded %s to the shulker queue" , Formatting .GREEN , stack .toHoverableText ());
4632
4733 return SINGLE_SUCCESS ;
4834 }));
4935
5036 builder .then (literal ("remove" ).executes (context -> {
5137 if (mc .player == null ) {
52- Text msg = OmegawareAddons .PREFIX .copy ()
53- .append (Text .literal ("Error: " ).formatted (Formatting .RED ))
54- .append (Text .literal ("Player was somehow null" ).formatted (Formatting .WHITE ));
55- ChatUtils .sendMsg (msg );
56-
38+ Logger .error ("Player was somehow null" );
5739 return SINGLE_SUCCESS ;
5840 }
5941
6042 ItemStack stack = mc .player .getMainHandStack ();
6143 if (stack .isEmpty ()) {
62- Text msg = OmegawareAddons .PREFIX .copy ()
63- .append (Text .literal ("Error: " ).formatted (Formatting .RED ))
64- .append (Text .literal ("You must hold an item in your main hand" ).formatted (Formatting .WHITE ));
65- ChatUtils .sendMsg (msg );
66-
44+ Logger .error ("You must hold an item in your main hand" );
6745 return SINGLE_SUCCESS ;
6846 }
6947 if (!ItemFrameDupeModule .shulkerQueue .contains (stack .copy ())) {
70- Text msg = OmegawareAddons .PREFIX .copy ()
71- .append (Text .literal ("Error: " ).formatted (Formatting .RED ))
72- .append (Text .literal ("Item is not in the shulker queue" ).formatted (Formatting .WHITE ));
73- ChatUtils .sendMsg (msg );
74-
48+ Logger .error ("Item is not in the shulker queue" );
7549 return SINGLE_SUCCESS ;
7650 }
7751
7852 ItemFrameDupeModule .shulkerQueue .remove (stack .copy ());
7953
80- Text msg = OmegawareAddons .PREFIX .copy ()
81- .append (Text .literal ("Removed " ).formatted (Formatting .RED ))
82- .append (stack .toHoverableText ())
83- .append (Text .literal (" from the shulker queue" ).formatted (Formatting .WHITE ));
84- ChatUtils .sendMsg (msg );
85-
54+ Logger .info ("%sRemoved%s %s from the shulker queue" , Formatting .RED , Formatting .WHITE ,stack .toHoverableText ());
8655 return SINGLE_SUCCESS ;
8756 }));
8857
8958 builder .then (literal ("list" ).executes (context -> {
9059 if (mc .player == null ) {
91- Text msg = OmegawareAddons .PREFIX .copy ()
92- .append (Text .literal ("Error: " ).formatted (Formatting .RED ))
93- .append (Text .literal ("Player was somehow null" ).formatted (Formatting .WHITE ));
94- ChatUtils .sendMsg (msg );
95-
60+ Logger .error ("Player was somehow null" );
9661 return SINGLE_SUCCESS ;
9762 }
9863
9964 if (ItemFrameDupeModule .shulkerQueue .isEmpty ()) {
100- Text msg = OmegawareAddons .PREFIX .copy ()
101- .append (Text .literal ("Shulker queue is empty" ).formatted (Formatting .WHITE ));
102- ChatUtils .sendMsg (msg );
65+ Logger .info ("Shulker queue is empty" );
10366 } else {
104- Text msg = OmegawareAddons .PREFIX .copy ()
105- .append (Text .literal ("Shulker queue: " ).formatted (Formatting .YELLOW ));
106- ChatUtils .sendMsg (msg );
107-
108- ItemFrameDupeModule .shulkerQueue .forEach (itemStack -> {
109- Text itemText = itemStack .toHoverableText ();
110- ChatUtils .sendMsg (itemText );
111- });
67+ StringBuilder sb = new StringBuilder ("Shulker queue: " );
68+ ItemFrameDupeModule .shulkerQueue .forEach (itemStack -> sb .append (itemStack .toHoverableText ().getString ()).append ("\n " ));
69+ Logger .info (sb .toString ());
11270 }
11371
11472 return SINGLE_SUCCESS ;
11573 }));
11674
11775 builder .then (literal ("clear" ).executes (context -> {
11876 if (mc .player == null ) {
119- Text msg = OmegawareAddons .PREFIX .copy ()
120- .append (Text .literal ("Error: " ).formatted (Formatting .RED ))
121- .append (Text .literal ("Player was somehow null" ).formatted (Formatting .WHITE ));
122- ChatUtils .sendMsg (msg );
77+ Logger .error ("Player was somehow null" );
12378
12479 return SINGLE_SUCCESS ;
12580 }
12681
12782 ItemFrameDupeModule .shulkerQueue .clear ();
12883
129- Text msg = OmegawareAddons .PREFIX .copy ()
130- .append (Text .literal ("Cleared the shulker queue" ).formatted (Formatting .WHITE ));
131- ChatUtils .sendMsg (msg );
84+ Logger .info ("Cleared the shulker queue" );
13285
13386 return SINGLE_SUCCESS ;
13487 }));
0 commit comments