mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
use Locale.ROOT for uppercase as well
This commit is contained in:
@ -35,6 +35,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@ -104,12 +105,12 @@ public class SimpleDispatcher implements Dispatcher {
|
||||
|
||||
@Override
|
||||
public boolean contains(String alias) {
|
||||
return commands.containsKey(alias.toLowerCase());
|
||||
return commands.containsKey(alias.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMapping get(String alias) {
|
||||
return commands.get(alias.toLowerCase());
|
||||
return commands.get(alias.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,6 +23,7 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public final class ArgumentUtils {
|
||||
|
||||
@ -35,7 +36,7 @@ public final class ArgumentUtils {
|
||||
}
|
||||
List<String> suggestions = Lists.newArrayList();
|
||||
for (String item : items) {
|
||||
if (item.toLowerCase().startsWith(s)) {
|
||||
if (item.toLowerCase(Locale.ROOT).startsWith(s)) {
|
||||
suggestions.add(item);
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import com.sk89q.worldedit.util.command.argument.CommandArgs;
|
||||
import com.sk89q.worldedit.util.command.argument.MissingArgumentException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@ -55,7 +56,7 @@ public abstract class BranchingCommand<T> implements CommandExecutor<T> {
|
||||
public T call(CommandArgs args, CommandLocals locals) throws CommandException {
|
||||
try {
|
||||
String classifier = args.next();
|
||||
CommandExecutor<? extends T> executor = options.get(classifier.toLowerCase());
|
||||
CommandExecutor<? extends T> executor = options.get(classifier.toLowerCase(Locale.ROOT));
|
||||
if (executor != null) {
|
||||
return executor.call(args, locals);
|
||||
} else {
|
||||
@ -72,7 +73,7 @@ public abstract class BranchingCommand<T> implements CommandExecutor<T> {
|
||||
public List<String> getSuggestions(CommandArgs args, CommandLocals locals) throws MissingArgumentException {
|
||||
String classifier = args.next();
|
||||
try {
|
||||
CommandExecutor<? extends T> executor = options.get(classifier.toLowerCase());
|
||||
CommandExecutor<? extends T> executor = options.get(classifier.toLowerCase(Locale.ROOT));
|
||||
if (executor != null) {
|
||||
return executor.getSuggestions(args, locals);
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@ -348,10 +349,10 @@ public class ParametricCallable extends AParametricCallable {
|
||||
*/
|
||||
private static String generateName(Type type, Annotation classifier, int index) {
|
||||
if (classifier != null) {
|
||||
return classifier.annotationType().getSimpleName().toLowerCase();
|
||||
return classifier.annotationType().getSimpleName().toLowerCase(Locale.ROOT);
|
||||
} else {
|
||||
if (type instanceof Class<?>) {
|
||||
return ((Class<?>) type).getSimpleName().toLowerCase();
|
||||
return ((Class<?>) type).getSimpleName().toLowerCase(Locale.ROOT);
|
||||
} else {
|
||||
return "unknown" + index;
|
||||
}
|
||||
|
Reference in New Issue
Block a user