Use rootian locale for case conversion.

This commit is contained in:
slicedlime (Mikael Hedberg) 2021-03-18 15:32:47 +01:00 committed by slicedlime (Mikael Hedberg)
parent 60a94e529d
commit cf754c4ef6
3 changed files with 6 additions and 3 deletions

View file

@ -20,6 +20,7 @@ import java.util.Collections;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -588,7 +589,7 @@ public class CommandDispatcher<S> {
final String fullInput = parse.getReader().getString(); final String fullInput = parse.getReader().getString();
final String truncatedInput = fullInput.substring(0, cursor); final String truncatedInput = fullInput.substring(0, cursor);
final String truncatedInputLowerCase = truncatedInput.toLowerCase(); final String truncatedInputLowerCase = truncatedInput.toLowerCase(Locale.ROOT);
@SuppressWarnings("unchecked") final CompletableFuture<Suggestions>[] futures = new CompletableFuture[parent.getChildren().size()]; @SuppressWarnings("unchecked") final CompletableFuture<Suggestions>[] futures = new CompletableFuture[parent.getChildren().size()];
int i = 0; int i = 0;
for (final CommandNode<S> node : parent.getChildren()) { for (final CommandNode<S> node : parent.getChildren()) {

View file

@ -8,6 +8,7 @@ import com.mojang.brigadier.context.StringRange;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
public class SuggestionsBuilder { public class SuggestionsBuilder {
@ -27,7 +28,7 @@ public class SuggestionsBuilder {
} }
public SuggestionsBuilder(final String input, final int start) { public SuggestionsBuilder(final String input, final int start) {
this(input, input.toLowerCase(), start); this(input, input.toLowerCase(Locale.ROOT), start);
} }
public String getInput() { public String getInput() {

View file

@ -16,6 +16,7 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Locale;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate; import java.util.function.Predicate;
@ -26,7 +27,7 @@ public class LiteralCommandNode<S> extends CommandNode<S> {
public LiteralCommandNode(final String literal, final Command<S> command, final Predicate<S> requirement, final CommandNode<S> redirect, final RedirectModifier<S> modifier, final boolean forks) { public LiteralCommandNode(final String literal, final Command<S> command, final Predicate<S> requirement, final CommandNode<S> redirect, final RedirectModifier<S> modifier, final boolean forks) {
super(command, requirement, redirect, modifier, forks); super(command, requirement, redirect, modifier, forks);
this.literal = literal; this.literal = literal;
this.literalLowerCase = literal.toLowerCase(); this.literalLowerCase = literal.toLowerCase(Locale.ROOT);
} }
public String getLiteral() { public String getLiteral() {