@@ -78,7 +78,7 @@ public class SettingsManager {
78
78
private MinecraftServer server ;
79
79
private final List <RuleObserver > observers = new ArrayList <>();
80
80
private static final List <RuleObserver > staticObservers = new ArrayList <>();
81
- static record ConfigReadResult (Map <String , String > ruleMap , boolean locked ) {}
81
+ record ConfigReadResult (Map <String , String > ruleMap , boolean locked ) {}
82
82
83
83
/**
84
84
* <p>Defines a class that can be notified about a {@link CarpetRule} changing.</p>
@@ -88,7 +88,7 @@ static record ConfigReadResult(Map<String, String> ruleMap, boolean locked) {}
88
88
* @see SettingsManager#registerGlobalRuleObserver(RuleObserver)
89
89
*/
90
90
@ FunctionalInterface
91
- public static interface RuleObserver {
91
+ public interface RuleObserver {
92
92
/**
93
93
* <p>Notifies this {@link RuleObserver} about the change of a {@link CarpetRule}.</p>
94
94
*
@@ -362,7 +362,7 @@ private void disableBooleanCommands()
362
362
if (rule .suggestions ().contains ("false" ))
363
363
rule .set (server .createCommandSourceStack (), "false" );
364
364
else
365
- CarpetSettings .LOG .warn ("Couldn't disable command rule " + rule . name () + " : it doesn't suggest false as a valid option" );
365
+ CarpetSettings .LOG .warn ("Couldn't disable command rule {} : it doesn't suggest false as a valid option" , rule . name () );
366
366
} catch (InvalidRuleValueException e ) {
367
367
throw new IllegalStateException (e ); // contract of CarpetRule.suggestions()
368
368
}
@@ -569,7 +569,7 @@ static CompletableFuture<Suggestions> suggestMatchingContains(Stream<String> str
569
569
String query = suggestionsBuilder .getRemaining ().toLowerCase (Locale .ROOT );
570
570
stream .forEach ((listItem ) -> {
571
571
// Regex camelCase Search
572
- var words = Arrays .stream (listItem .split ("(?<!^)(?=[A-Z])" )).map (s -> s .toLowerCase (Locale .ROOT )).collect ( Collectors . toList () );
572
+ var words = Arrays .stream (listItem .split ("(?<!^)(?=[A-Z])" )).map (s -> s .toLowerCase (Locale .ROOT )).toList ();
573
573
var prefixes = new ArrayList <String >(words .size ());
574
574
for (int i = 0 ; i < words .size (); i ++)
575
575
prefixes .add (String .join ("" , words .subList (i , words .size ())));
@@ -658,8 +658,8 @@ private int displayRuleMenu(CommandSourceStack source, CarpetRule<?> rule) //TOD
658
658
tags .add (Messenger .c ("c [" + translated +"]" , "^g " + String .format (tr (TranslationKeys .LIST_ALL_CATEGORY ), translated ),"!/" +identifier +" list " +t ));
659
659
tags .add (Messenger .c ("w , " ));
660
660
}
661
- tags .remove ( tags . size () - 1 );
662
- Messenger .m (source , tags .toArray (new Object [ 0 ] ));
661
+ tags .removeLast ( );
662
+ Messenger .m (source , tags .toArray ());
663
663
664
664
Messenger .m (source , "w " + tr (TranslationKeys .CURRENT_VALUE )+": " , String .format ("%s %s (%s value)" , RuleHelper .getBooleanValue (rule ) ? "lb" : "nb" , RuleHelper .toRuleString (rule .value ()), RuleHelper .isInDefaultValue (rule ) ? "default" : "modified" ));
665
665
List <Component > options = new ArrayList <>();
@@ -669,9 +669,9 @@ private int displayRuleMenu(CommandSourceStack source, CarpetRule<?> rule) //TOD
669
669
options .add (makeSetRuleButton (rule , o , false ));
670
670
options .add (Messenger .c ("w " ));
671
671
}
672
- options .remove ( options . size ()- 1 );
672
+ options .removeLast ( );
673
673
options .add (Messenger .c ("y ]" ));
674
- Messenger .m (source , options .toArray (new Object [ 0 ] ));
674
+ Messenger .m (source , options .toArray ());
675
675
676
676
return 1 ;
677
677
}
@@ -736,8 +736,8 @@ private Component displayInteractiveSetting(CarpetRule<?> rule)
736
736
args .add (makeSetRuleButton (rule , RuleHelper .toRuleString (rule .value ()), true ));
737
737
args .add ("w " );
738
738
}
739
- args .remove ( args . size ()- 1 );
740
- return Messenger .c (args .toArray (new Object [ 0 ] ));
739
+ args .removeLast ( );
740
+ return Messenger .c (args .toArray ());
741
741
}
742
742
743
743
private Component makeSetRuleButton (CarpetRule <?> rule , String option , boolean brackets )
@@ -780,8 +780,8 @@ private int listAllSettings(CommandSourceStack source)
780
780
tags .add ("!/" +identifier +" list " + t );
781
781
tags .add ("w " );
782
782
}
783
- tags .remove ( tags . size () - 1 );
784
- Messenger .m (source , tags .toArray (new Object [ 0 ] ));
783
+ tags .removeLast ( );
784
+ Messenger .m (source , tags .toArray ());
785
785
786
786
return count ;
787
787
}
0 commit comments