Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-26 11:00:04 +01:00
Don't use a no-op suggester
Dieser Commit ist enthalten in:
Ursprung
a3ffb91917
Commit
4804fe64e3
@ -97,7 +97,7 @@ public class FactoryConverter<T> implements ArgumentConverter<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getSuggestions(String input) {
|
public List<String> getSuggestions(String input) {
|
||||||
return limitByPrefix(factoryExtractor.apply(worldEdit).getSuggestions(), input);
|
return factoryExtractor.apply(worldEdit).getSuggestions(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -201,7 +201,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<String> getSuggestions() {
|
public Stream<String> getSuggestions(String input) {
|
||||||
// TODO Include states
|
// TODO Include states
|
||||||
return BlockType.REGISTRY.keySet().stream();
|
return BlockType.REGISTRY.keySet().stream();
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class DefaultItemParser extends InputParser<BaseItem> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<String> getSuggestions() {
|
public Stream<String> getSuggestions(String input) {
|
||||||
return ItemType.REGISTRY.keySet().stream();
|
return ItemType.REGISTRY.keySet().stream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class BiomeMaskParser extends InputParser<Mask> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<String> getSuggestions() {
|
public Stream<String> getSuggestions(String input) {
|
||||||
return BiomeType.REGISTRY.keySet().stream().map(biomeType -> "$" + biomeType);
|
return BiomeType.REGISTRY.keySet().stream().map(biomeType -> "$" + biomeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class BlockCategoryMaskParser extends InputParser<Mask> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<String> getSuggestions() {
|
public Stream<String> getSuggestions(String input) {
|
||||||
return BlockCategory.REGISTRY.keySet().stream().map(str -> "##" + str);
|
return BlockCategory.REGISTRY.keySet().stream().map(str -> "##" + str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ public class BlocksMaskParser extends InputParser<Mask> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<String> getSuggestions() {
|
public Stream<String> getSuggestions(String input) {
|
||||||
return worldEdit.getBlockFactory().getSuggestions();
|
return worldEdit.getBlockFactory().getSuggestions(input).stream();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,7 +40,7 @@ public class BlockCategoryPatternParser extends InputParser<Pattern> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<String> getSuggestions() {
|
public Stream<String> getSuggestions(String input) {
|
||||||
return BlockCategory.REGISTRY.keySet().stream().map(str -> "##" + str);
|
return BlockCategory.REGISTRY.keySet().stream().map(str -> "##" + str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class ClipboardPatternParser extends InputParser<Pattern> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<String> getSuggestions() {
|
public Stream<String> getSuggestions(String input) {
|
||||||
return Stream.of("#clipboard", "#copy");
|
return Stream.of("#clipboard", "#copy");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ public class SingleBlockPatternParser extends InputParser<Pattern> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<String> getSuggestions() {
|
public Stream<String> getSuggestions(String input) {
|
||||||
return worldEdit.getBlockFactory().getSuggestions();
|
return worldEdit.getBlockFactory().getSuggestions(input).stream();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package com.sk89q.worldedit.internal.registry;
|
package com.sk89q.worldedit.internal.registry;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
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.WorldEdit;
|
||||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||||
@ -79,8 +80,8 @@ public abstract class AbstractFactory<E> {
|
|||||||
throw new NoMatchException("No match for '" + input + "'");
|
throw new NoMatchException("No match for '" + input + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream<String> getSuggestions() {
|
public List<String> getSuggestions(String input) {
|
||||||
return parsers.stream().flatMap(InputParser::getSuggestions);
|
return limitByPrefix(parsers.stream().flatMap(parser -> parser.getSuggestions(input)), input);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +48,7 @@ public abstract class InputParser<E> {
|
|||||||
*
|
*
|
||||||
* @return a stream of suggestions
|
* @return a stream of suggestions
|
||||||
*/
|
*/
|
||||||
public Stream<String> getSuggestions() {
|
public Stream<String> getSuggestions(String input) {
|
||||||
return Stream.empty();
|
return Stream.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public abstract class SimpleInputParser<E> extends InputParser<E> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<String> getSuggestions() {
|
public Stream<String> getSuggestions(String input) {
|
||||||
return Stream.of(getPrimaryMatcher());
|
return Stream.of(getPrimaryMatcher());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren