feat: allow captions in SuggestInputParseException (#2239)

- Deprecate for removal methods using string message
 - Fixes #2026
This commit is contained in:
Jordan
2023-05-22 19:32:56 +01:00
committed by GitHub
parent 74aff920a8
commit 7c01c1e95e
6 changed files with 76 additions and 25 deletions

View File

@ -50,7 +50,7 @@ public class RichMaskParser extends FaweParser<Mask> {
@Override
public Mask parseFromInput(String input, ParserContext context) throws InputParseException {
if (input.isEmpty()) {
throw new SuggestInputParseException("No input provided", "", () -> Stream
throw new SuggestInputParseException(Caption.of("fawe.error.no-input-provided"), () -> Stream
.of("#", ",", "&")
.map(n -> n + ":")
.collect(Collectors.toList())
@ -95,7 +95,6 @@ public class RichMaskParser extends FaweParser<Mask> {
"https://intellectualsites.github.io/fastasyncworldedit-documentation/patterns/patterns"
))
)),
full,
() -> {
if (full.length() == 1) {
return new ArrayList<>(worldEdit.getMaskFactory().getSuggestions(""));
@ -162,7 +161,6 @@ public class RichMaskParser extends FaweParser<Mask> {
"https://intellectualsites.github.io/fastasyncworldedit-documentation/masks/masks"
))
)),
full,
() -> {
if (full.length() == 1) {
return new ArrayList<>(worldEdit.getMaskFactory().getSuggestions(""));

View File

@ -47,8 +47,7 @@ public class RichPatternParser extends FaweParser<Pattern> {
public Pattern parseFromInput(String input, ParserContext context) throws InputParseException {
if (input.isEmpty()) {
throw new SuggestInputParseException(
"No input provided",
"",
Caption.of("fawe.error.no-input-provided"),
() -> Stream
.concat(Stream.of("#", ",", "&"), BlockTypes.getNameSpaces().stream().map(n -> n + ":"))
.collect(Collectors.toList())
@ -88,7 +87,6 @@ public class RichPatternParser extends FaweParser<Pattern> {
"https://intellectualsites.github.io/fastasyncworldedit-documentation/patterns/patterns"
))
)),
full,
() -> {
if (full.length() == 1) {
return new ArrayList<>(worldEdit.getPatternFactory().getSuggestions(""));