@@ -457,10 +457,8 @@ public int displayRuleMenu(@NotNull CommandSourceStack source, @NotNull RuleOpti
457
457
ComponentUtil .simpleCompat (this .getTranslatedRuleName (source , ruleOption .getName ()))
458
458
.withStyleCompat (style -> style
459
459
.withBold (true )
460
- .withClickEvent (ClickEventCompat .of (ClickEvent .Action .RUN_COMMAND ,
461
- String .format ("/%s %s" , this .identifier , ruleOption .getName ())))
462
- .withHoverEvent (HoverEventCompat .of (HoverEvent .Action .SHOW_TEXT ,
463
- ComponentUtil .trCompat ("magiclib.ui.hover.refresh" )
460
+ .withClickEvent (ClickEventCompat .runCommand (String .format ("/%s %s" , this .identifier , ruleOption .getName ())))
461
+ .withHoverEvent (HoverEventCompat .showTextCompat (ComponentUtil .trCompat ("magiclib.ui.hover.refresh" )
464
462
.withStyleCompat (style1 -> style1 .withColor (ChatFormatting .GRAY ))))));
465
463
466
464
String descTranslationKey = String .format ("%s.rule.%s.desc" , this .identifier , ruleOption .getName ());
@@ -479,10 +477,8 @@ public int displayRuleMenu(@NotNull CommandSourceStack source, @NotNull RuleOpti
479
477
ComponentUtil .tr (String .format ("%s.category.%s" , this .identifier , category )),
480
478
ComponentUtil .simple ("]" )).withStyleCompat (style -> style
481
479
.withColor (ChatFormatting .AQUA )
482
- .withClickEvent (ClickEventCompat .of (ClickEvent .Action .RUN_COMMAND ,
483
- String .format ("/%s list %s" , this .identifier , category )))
484
- .withHoverEvent (HoverEventCompat .of (HoverEvent .Action .SHOW_TEXT ,
485
- ComponentUtil .trCompat ("magiclib.ui.hover.list_all_category" , category )))))
480
+ .withClickEvent (ClickEventCompat .runCommand (String .format ("/%s list %s" , this .identifier , category )))
481
+ .withHoverEvent (HoverEventCompat .showTextCompat (ComponentUtil .trCompat ("magiclib.ui.hover.list_all_category" , category )))))
486
482
.collect (Collectors .toList ())));
487
483
488
484
if (categories .size () < 2 ) {
@@ -512,11 +508,9 @@ public int displayRuleMenu(@NotNull CommandSourceStack source, @NotNull RuleOpti
512
508
ruleOption .getDefaultStringValue ().equals (option ) ? ChatFormatting .DARK_GREEN :
513
509
ChatFormatting .YELLOW )
514
510
.withClickEvent (ruleOption .getStringValue ().equals (option ) || this .locked () ? null :
515
- ClickEventCompat .of (ClickEvent .Action .SUGGEST_COMMAND ,
516
- String .format ("/%s %s %s" , this .identifier , ruleOption .getName (), option )))
511
+ ClickEventCompat .suggestCommand (String .format ("/%s %s %s" , this .identifier , ruleOption .getName (), option )))
517
512
.withHoverEvent (ruleOption .getStringValue ().equals (option ) || this .locked () ? null :
518
- HoverEventCompat .of (HoverEvent .Action .SHOW_TEXT ,
519
- ComponentUtil .trCompat ("magiclib.ui.hover.switch_to" , option )))))
513
+ HoverEventCompat .showTextCompat (ComponentUtil .trCompat ("magiclib.ui.hover.switch_to" , option )))))
520
514
.collect (Collectors .toList ())),
521
515
ComponentUtil .simple (" ]" ).withStyle (style -> style .withColor (ChatFormatting .YELLOW ))));
522
516
return 1 ;
@@ -543,10 +537,9 @@ public int setRule(CommandSourceStack source, @NotNull RuleOption ruleOption, St
543
537
ComponentUtil .tr ("magiclib.ui.change_permanently" ),
544
538
ComponentUtil .simple ("]" )).withStyleCompat (style -> style
545
539
.withColor (ChatFormatting .AQUA )
546
- .withClickEvent (ClickEventCompat .of (ClickEvent .Action .RUN_COMMAND ,
547
- String .format ("/%s setDefault %s %s" ,
540
+ .withClickEvent (ClickEventCompat .runCommand (String .format ("/%s setDefault %s %s" ,
548
541
this .identifier , ruleOption .getName (), newValue )))
549
- .withHoverEvent (HoverEventCompat .of ( HoverEvent . Action . SHOW_TEXT ,
542
+ .withHoverEvent (HoverEventCompat .showTextCompat (
550
543
ComponentUtil .trCompat ("magiclib.ui.hover.change_permanently" ,
551
544
String .format ("%s.conf" , this .identifier ))))))));
552
545
return 1 ;
@@ -644,8 +637,8 @@ public Collection<List<Component>> getMatchedSettings(@NotNull Collection<RuleOp
644
637
for (RuleOption ruleOption : ruleOptions ) {
645
638
List <MutableComponentCompat > components = Lists .newArrayList ();
646
639
components .add (ComponentCompat .literalCompat (String .format ("- %s" , this .getTranslatedRuleName (ruleOption .getName ()))).withStyleCompat (style -> style
647
- .withClickEvent (ClickEventCompat .of ( ClickEvent . Action . RUN_COMMAND , String .format ("/%s %s" , this .identifier , ruleOption .getName ())))
648
- .withHoverEvent (HoverEventCompat .of ( HoverEvent . Action . SHOW_TEXT , ComponentCompat .literalCompat (this .trRuleDesc (ruleOption .getName ())).withStyle (style1 -> style1 .withColor (ChatFormatting .YELLOW ))))));
640
+ .withClickEvent (ClickEventCompat .runCommand ( String .format ("/%s %s" , this .identifier , ruleOption .getName ())))
641
+ .withHoverEvent (HoverEventCompat .showTextCompat ( ComponentCompat .literalCompat (this .trRuleDesc (ruleOption .getName ())).withStyle (style1 -> style1 .withColor (ChatFormatting .YELLOW ))))));
649
642
components .add (ComponentCompat .literalCompat (" " ));
650
643
List <String > options = new ArrayList <>(ruleOption .getOptions ());
651
644
@@ -657,8 +650,8 @@ public Collection<List<Component>> getMatchedSettings(@NotNull Collection<RuleOp
657
650
components .add (ComponentCompat .literalCompat (String .format ("[%s]" , option )).withStyleCompat (style ->
658
651
style .withUnderlined (ruleOption .getStringValue ().equals (option ))
659
652
.withColor (ruleOption .isDefault () ? ChatFormatting .GRAY : ruleOption .getDefaultStringValue ().equals (option ) ? ChatFormatting .DARK_GREEN : ChatFormatting .YELLOW )
660
- .withClickEvent (ruleOption .getStringValue ().equals (option ) || this .locked () ? null : ClickEventCompat .of ( ClickEvent . Action . SUGGEST_COMMAND , String .format ("/%s %s %s" , this .identifier , ruleOption .getName (), option )))
661
- .withHoverEvent (ruleOption .getStringValue ().equals (option ) || this .locked () ? null : HoverEventCompat .of ( HoverEvent . Action . SHOW_TEXT , ComponentCompat .literalCompat (this .trUI ("hover.switch_to" , option ))))));
653
+ .withClickEvent (ruleOption .getStringValue ().equals (option ) || this .locked () ? null : ClickEventCompat .suggestCommand ( String .format ("/%s %s %s" , this .identifier , ruleOption .getName (), option )))
654
+ .withHoverEvent (ruleOption .getStringValue ().equals (option ) || this .locked () ? null : HoverEventCompat .showTextCompat ( ComponentCompat .literalCompat (this .trUI ("hover.switch_to" , option ))))));
662
655
components .add (ComponentCompat .literalCompat (" " ));
663
656
}
664
657
@@ -678,13 +671,11 @@ public Collection<MutableComponentCompat> getMatchedSettings(CommandSourceStack
678
671
List <MutableComponentCompat > components = Lists .newArrayList ();
679
672
components .add (ComponentUtil .composeCompat ("- " ,
680
673
this .getTranslatedRuleName (source , option .getName ())).withStyleCompat (style -> {
681
- style .withClickEvent (ClickEventCompat .of (ClickEvent .Action .RUN_COMMAND ,
682
- String .format ("/%s %s" , this .identifier , option .getName ())));
674
+ style .withClickEvent (ClickEventCompat .runCommand (String .format ("/%s %s" , this .identifier , option .getName ())));
683
675
String descTranslationKey = String .format ("%s.rule.%s.desc" , this .identifier , option .getName ());
684
676
685
677
if (I18n .exists (descTranslationKey )) {
686
- style .withHoverEvent (HoverEventCompat .of (HoverEvent .Action .SHOW_TEXT ,
687
- ComponentUtil .trCompat (descTranslationKey )
678
+ style .withHoverEvent (HoverEventCompat .showTextCompat (ComponentUtil .trCompat (descTranslationKey )
688
679
.withStyleCompat (style1 -> style1 .withColor (ChatFormatting .YELLOW ))));
689
680
}
690
681
@@ -704,10 +695,9 @@ public Collection<MutableComponentCompat> getMatchedSettings(CommandSourceStack
704
695
o .equals (option .getDefaultStringValue ()) ? ChatFormatting .DARK_GREEN :
705
696
ChatFormatting .YELLOW )
706
697
.withClickEvent (o .equals (option .getStringValue ()) || this .locked () ? null :
707
- ClickEventCompat .of (ClickEvent .Action .SUGGEST_COMMAND ,
708
- String .format ("/%s %s %s" , this .identifier , option .getName (), o )))
698
+ ClickEventCompat .suggestCommand (String .format ("/%s %s %s" , this .identifier , option .getName (), o )))
709
699
.withHoverEvent (o .equals (option .getStringValue ()) || this .locked () ? null :
710
- HoverEventCompat .of ( HoverEvent . Action . SHOW_TEXT ,
700
+ HoverEventCompat .showTextCompat (
711
701
ComponentUtil .trCompat ("magiclib.ui.hover.switch_to" , o )))))
712
702
.collect (Collectors .toList ())));
713
703
ret .add (ComponentUtil .joinCompat (ComponentUtil .emptyCompat (), components ));
@@ -748,10 +738,8 @@ private int displayMainMenu(CommandSourceStack source) {
748
738
ComponentUtil .tr (String .format ("%s.category.%s" , this .identifier , category )),
749
739
"]" ).withStyleCompat (style -> style
750
740
.withColor (ChatFormatting .AQUA )
751
- .withClickEvent (ClickEventCompat .of (ClickEvent .Action .RUN_COMMAND ,
752
- String .format ("/%s list %s" , this .identifier , category )))
753
- .withHoverEvent (HoverEventCompat .of (HoverEvent .Action .SHOW_TEXT ,
754
- ComponentUtil .trCompat ("magiclib.ui.hover.list_all_category" , category )))));
741
+ .withClickEvent (ClickEventCompat .runCommand (String .format ("/%s list %s" , this .identifier , category )))
742
+ .withHoverEvent (HoverEventCompat .showTextCompat (ComponentUtil .trCompat ("magiclib.ui.hover.list_all_category" , category )))));
755
743
}
756
744
});
757
745
0 commit comments