mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 12:36:40 +00:00
Give factories a default parser.
Later registered parsers will always come before the default, ensuring that the default parser is used when no other parser can match the input, and that errors may be thrown by it to signify the end of the line.
This commit is contained in:
@ -54,6 +54,8 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.enginehub.piston.converter.SuggestionHelper.limitByPrefix;
|
||||
|
||||
/**
|
||||
* Parses block input strings.
|
||||
*/
|
||||
@ -209,7 +211,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
||||
if (input.contains(",")) {
|
||||
return Stream.empty();
|
||||
}
|
||||
return BlockType.REGISTRY.keySet().stream();
|
||||
return limitByPrefix(BlockType.REGISTRY.keySet().stream(), input).stream();
|
||||
}
|
||||
String blockType = input.substring(0, idx);
|
||||
BlockType type = BlockTypes.get(blockType.toLowerCase(Locale.ROOT));
|
||||
|
Reference in New Issue
Block a user