99import net .minecraft .util .Formatting ;
1010import xyz .omegaware .addon .OmegawareAddons ;
1111import xyz .omegaware .addon .modules .ItemFrameDupeModule ;
12+ import xyz .omegaware .addon .utils .Logger ;
1213
1314public class ShulkerQueueCommand extends Command {
1415 public ShulkerQueueCommand () {
@@ -19,116 +20,71 @@ public ShulkerQueueCommand() {
1920 public void build (LiteralArgumentBuilder <CommandSource > builder ) {
2021 builder .then (literal ("add" ).executes (context -> {
2122 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-
23+ Logger .error ("Player was somehow null" );
2724 return SINGLE_SUCCESS ;
2825 }
2926
3027 ItemStack stack = mc .player .getMainHandStack ();
3128 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-
29+ Logger .error ("You must hold an item in your main hand" );
3730 return SINGLE_SUCCESS ;
3831 }
3932 ItemFrameDupeModule .shulkerQueue .add (stack .copy ());
4033
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 );
34+ Logger .info ("%sAdded %s to the shulker queue" , Formatting .GREEN , stack .toHoverableText ());
4635
4736 return SINGLE_SUCCESS ;
4837 }));
4938
5039 builder .then (literal ("remove" ).executes (context -> {
5140 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-
41+ Logger .error ("Player was somehow null" );
5742 return SINGLE_SUCCESS ;
5843 }
5944
6045 ItemStack stack = mc .player .getMainHandStack ();
6146 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-
47+ Logger .error ("You must hold an item in your main hand" );
6748 return SINGLE_SUCCESS ;
6849 }
6950 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-
51+ Logger .error ("Item is not in the shulker queue" );
7552 return SINGLE_SUCCESS ;
7653 }
7754
7855 ItemFrameDupeModule .shulkerQueue .remove (stack .copy ());
7956
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-
57+ Logger .info ("%sRemoved%s %s from the shulker queue" , Formatting .RED , Formatting .WHITE ,stack .toHoverableText ());
8658 return SINGLE_SUCCESS ;
8759 }));
8860
8961 builder .then (literal ("list" ).executes (context -> {
9062 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-
63+ Logger .error ("Player was somehow null" );
9664 return SINGLE_SUCCESS ;
9765 }
9866
9967 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 );
68+ Logger .info ("Shulker queue is empty" );
10369 } 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- });
70+ StringBuilder sb = new StringBuilder ("Shulker queue: " );
71+ ItemFrameDupeModule .shulkerQueue .forEach (itemStack -> sb .append (itemStack .toHoverableText ().getString ()).append ("\n " ));
72+ Logger .info (sb .toString ());
11273 }
11374
11475 return SINGLE_SUCCESS ;
11576 }));
11677
11778 builder .then (literal ("clear" ).executes (context -> {
11879 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 );
80+ Logger .error ("Player was somehow null" );
12381
12482 return SINGLE_SUCCESS ;
12583 }
12684
12785 ItemFrameDupeModule .shulkerQueue .clear ();
12886
129- Text msg = OmegawareAddons .PREFIX .copy ()
130- .append (Text .literal ("Cleared the shulker queue" ).formatted (Formatting .WHITE ));
131- ChatUtils .sendMsg (msg );
87+ Logger .info ("Cleared the shulker queue" );
13288
13389 return SINGLE_SUCCESS ;
13490 }));
0 commit comments