Skip to content

Commit

Permalink
Use rootian locale for case conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
slicedlime committed Mar 23, 2021
1 parent 60a94e5 commit cf754c4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/mojang/brigadier/CommandDispatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -588,7 +589,7 @@ public CompletableFuture<Suggestions> getCompletionSuggestions(final ParseResult

final String fullInput = parse.getReader().getString();
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()];
int i = 0;
for (final CommandNode<S> node : parent.getChildren()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;

public class SuggestionsBuilder {
Expand All @@ -27,7 +28,7 @@ public SuggestionsBuilder(final String input, final String inputLowerCase, final
}

public SuggestionsBuilder(final String input, final int start) {
this(input, input.toLowerCase(), start);
this(input, input.toLowerCase(Locale.ROOT), start);
}

public String getInput() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import java.util.Collection;
import java.util.Collections;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;

Expand All @@ -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) {
super(command, requirement, redirect, modifier, forks);
this.literal = literal;
this.literalLowerCase = literal.toLowerCase();
this.literalLowerCase = literal.toLowerCase(Locale.ROOT);
}

public String getLiteral() {
Expand Down

0 comments on commit cf754c4

Please sign in to comment.