3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-26 02:50:06 +01:00

Don't use a no-op suggester

Dieser Commit ist enthalten in:
Matthew Miller 2019-05-19 13:49:37 +10:00
Ursprung a3ffb91917
Commit 4804fe64e3
12 geänderte Dateien mit 16 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -97,7 +97,7 @@ public class FactoryConverter<T> implements ArgumentConverter<T> {
@Override
public List<String> getSuggestions(String input) {
return limitByPrefix(factoryExtractor.apply(worldEdit).getSuggestions(), input);
return factoryExtractor.apply(worldEdit).getSuggestions(input);
}
@Override

Datei anzeigen

@ -201,7 +201,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
}
@Override
public Stream<String> getSuggestions() {
public Stream<String> getSuggestions(String input) {
// TODO Include states
return BlockType.REGISTRY.keySet().stream();
}

Datei anzeigen

@ -41,7 +41,7 @@ public class DefaultItemParser extends InputParser<BaseItem> {
}
@Override
public Stream<String> getSuggestions() {
public Stream<String> getSuggestions(String input) {
return ItemType.REGISTRY.keySet().stream();
}

Datei anzeigen

@ -45,7 +45,7 @@ public class BiomeMaskParser extends InputParser<Mask> {
}
@Override
public Stream<String> getSuggestions() {
public Stream<String> getSuggestions(String input) {
return BiomeType.REGISTRY.keySet().stream().map(biomeType -> "$" + biomeType);
}

Datei anzeigen

@ -38,7 +38,7 @@ public class BlockCategoryMaskParser extends InputParser<Mask> {
}
@Override
public Stream<String> getSuggestions() {
public Stream<String> getSuggestions(String input) {
return BlockCategory.REGISTRY.keySet().stream().map(str -> "##" + str);
}

Datei anzeigen

@ -43,8 +43,8 @@ public class BlocksMaskParser extends InputParser<Mask> {
}
@Override
public Stream<String> getSuggestions() {
return worldEdit.getBlockFactory().getSuggestions();
public Stream<String> getSuggestions(String input) {
return worldEdit.getBlockFactory().getSuggestions(input).stream();
}
@Override

Datei anzeigen

@ -40,7 +40,7 @@ public class BlockCategoryPatternParser extends InputParser<Pattern> {
}
@Override
public Stream<String> getSuggestions() {
public Stream<String> getSuggestions(String input) {
return BlockCategory.REGISTRY.keySet().stream().map(str -> "##" + str);
}

Datei anzeigen

@ -40,7 +40,7 @@ public class ClipboardPatternParser extends InputParser<Pattern> {
}
@Override
public Stream<String> getSuggestions() {
public Stream<String> getSuggestions(String input) {
return Stream.of("#clipboard", "#copy");
}

Datei anzeigen

@ -36,8 +36,8 @@ public class SingleBlockPatternParser extends InputParser<Pattern> {
}
@Override
public Stream<String> getSuggestions() {
return worldEdit.getBlockFactory().getSuggestions();
public Stream<String> getSuggestions(String input) {
return worldEdit.getBlockFactory().getSuggestions(input).stream();
}
@Override

Datei anzeigen

@ -20,6 +20,7 @@
package com.sk89q.worldedit.internal.registry;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.enginehub.piston.converter.SuggestionHelper.limitByPrefix;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
@ -79,8 +80,8 @@ public abstract class AbstractFactory<E> {
throw new NoMatchException("No match for '" + input + "'");
}
public Stream<String> getSuggestions() {
return parsers.stream().flatMap(InputParser::getSuggestions);
public List<String> getSuggestions(String input) {
return limitByPrefix(parsers.stream().flatMap(parser -> parser.getSuggestions(input)), input);
}
/**

Datei anzeigen

@ -48,7 +48,7 @@ public abstract class InputParser<E> {
*
* @return a stream of suggestions
*/
public Stream<String> getSuggestions() {
public Stream<String> getSuggestions(String input) {
return Stream.empty();
}
}

Datei anzeigen

@ -66,7 +66,7 @@ public abstract class SimpleInputParser<E> extends InputParser<E> {
}
@Override
public Stream<String> getSuggestions() {
public Stream<String> getSuggestions(String input) {
return Stream.of(getPrimaryMatcher());
}
}