Skip to content

Commit

Permalink
Replace usages and overrides of deprecated getSuggestions method (#2891)
Browse files Browse the repository at this point in the history
  • Loading branch information
SirYwell authored Sep 10, 2024
1 parent 9cf79d0 commit 5ac4d2f
Show file tree
Hide file tree
Showing 39 changed files with 67 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public AdjacentMaskParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0) {
return worldEdit.getMaskFactory().getSuggestions(argumentInput).stream();
return worldEdit.getMaskFactory().getSuggestions(argumentInput, context).stream();
} else if (index == 1 || index == 2) {
return SuggestionHelper.suggestPositiveDoubles(argumentInput);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public AngleMaskParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0 || index == 1) {
return SuggestionHelper.suggestPositiveDoubles(argumentInput).flatMap(s -> Stream.of(s, s + "d"));
} else if (index > 1 && index <= 1 + flags.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public BesideMaskParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(final String argumentInput, final int index) {
protected Stream<String> getSuggestions(final String argumentInput, final int index, ParserContext context) {
if (index == 0) {
return worldEdit.getMaskFactory().getSuggestions(argumentInput).stream();
return worldEdit.getMaskFactory().getSuggestions(argumentInput, context).stream();
} else if (index == 1 || index == 2) {
return SuggestionHelper.suggestPositiveDoubles(argumentInput);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public ExtremaMaskParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0 || index == 1) {
return SuggestionHelper.suggestPositiveDoubles(argumentInput).flatMap(s -> Stream.of(s, s + "d"));
} else if (index > 1 && index <= 1 + flags.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public ROCAngleMaskParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0 || index == 1) {
return SuggestionHelper.suggestPositiveDoubles(argumentInput).flatMap(s -> Stream.of(s, s + "d"));
} else if (index > 1 && index <= 1 + flags.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public RadiusMaskParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0 || index == 1) {
return SuggestionHelper.suggestPositiveIntegers(argumentInput);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public RichOffsetMaskParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index < 3) {
return SuggestionHelper.suggestPositiveIntegers(argumentInput);
}
if (index == 3) {
return worldEdit.getMaskFactory().getSuggestions(argumentInput).stream();
return worldEdit.getMaskFactory().getSuggestions(argumentInput, context).stream();
}
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public SimplexMaskParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index < 3) {
return SuggestionHelper.suggestPositiveDoubles(argumentInput);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public SurfaceAngleMaskParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index <= 2) {
return SuggestionHelper.suggestPositiveDoubles(argumentInput);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public AngleColorPatternParser(WorldEdit worldEdit) {
}

@Override
public Stream<String> getSuggestions(String argumentInput, int index) {
public Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index != 0) {
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public AverageColorPatternParser(WorldEdit worldEdit) {
}

@Override
public Stream<String> getSuggestions(String argumentInput, int index) {
public Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index > 4) {
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Stream<String> getSuggestions(String input) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0) {
return BiomeType.REGISTRY.getSuggestions(argumentInput);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public BufferedPattern2DParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0) {
return this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
return this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
}
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public BufferedPatternParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0) {
return this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
return this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
}
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ColorPatternParser(WorldEdit worldEdit) {
}

@Override
public Stream<String> getSuggestions(String argumentInput, int index) {
public Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index > 4) {
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public DesaturatePatternParser(WorldEdit worldEdit) {
}

@Override
public Stream<String> getSuggestions(String argumentInput, int index) {
public Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0) {
return SuggestionHelper.suggestPositiveDoubles(argumentInput);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public Linear2DPatternParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
return switch (index) {
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
case 1, 2 -> SuggestionHelper.suggestPositiveIntegers(argumentInput);
default -> Stream.empty();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public Linear3DPatternParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
return switch (index) {
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
case 1, 2, 3 -> SuggestionHelper.suggestPositiveIntegers(argumentInput);
default -> Stream.empty();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public LinearPatternParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
return switch (index) {
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
case 1, 2, 3 -> SuggestionHelper.suggestPositiveIntegers(argumentInput);
default -> Stream.empty();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public MaskedPatternParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
return switch (index) {
case 0 -> this.worldEdit.getMaskFactory().getSuggestions(argumentInput).stream();
case 1, 2 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
case 0 -> this.worldEdit.getMaskFactory().getSuggestions(argumentInput, context).stream();
case 1, 2 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
default -> Stream.empty();
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public NoXPatternParser(WorldEdit worldEdit) {
}

@Override
public Stream<String> getSuggestions(String argumentInput, int index) {
public Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0) {
return this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
return this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
}
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public NoYPatternParser(WorldEdit worldEdit) {
}

@Override
public Stream<String> getSuggestions(String argumentInput, int index) {
public Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0) {
return this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
return this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
}
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public NoZPatternParser(WorldEdit worldEdit) {
}

@Override
public Stream<String> getSuggestions(String argumentInput, int index) {
public Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0) {
return this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
return this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
}
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ protected NoisePatternParser(WorldEdit worldEdit, String name, Supplier<NoiseGen
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0) {
return SuggestionHelper.suggestPositiveDoubles(argumentInput);
}
if (index == 1) {
return worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
return worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
}
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public OffsetPatternParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
return switch (index) {
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
case 1, 2, 3 -> SuggestionHelper.suggestPositiveIntegers(argumentInput);
default -> Stream.empty();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.fastasyncworldedit.core.extension.factory.parser.RichParser;
import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder;
import com.fastasyncworldedit.core.function.pattern.RandomFullClipboardPattern;
import com.google.common.base.Function;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.extension.input.InputParseException;
Expand Down Expand Up @@ -33,7 +34,7 @@ public RandomFullClipboardPatternParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
switch (index) {
case 0:
if (argumentInput.equals("#") || argumentInput.equals("#c")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public RandomOffsetPatternParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
return switch (index) {
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
case 1, 2, 3 -> SuggestionHelper.suggestPositiveIntegers(argumentInput);
default -> Stream.empty();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public RelativePatternParser(WorldEdit worldEdit) {
}

@Override
public Stream<String> getSuggestions(String argumentInput, int index) {
public Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0) {
return this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
return this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
}
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public SaturatePatternParser(WorldEdit worldEdit) {
}

@Override
public Stream<String> getSuggestions(String argumentInput, int index) {
public Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index > 3) {
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public SolidRandomOffsetPatternParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
return switch (index) {
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
case 1, 2, 3 -> SuggestionHelper.suggestPositiveIntegers(argumentInput);
default -> Stream.empty();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public SurfaceRandomOffsetPatternParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
return switch (index) {
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput).stream();
case 0 -> this.worldEdit.getPatternFactory().getSuggestions(argumentInput, context).stream();
case 1 -> SuggestionHelper.suggestPositiveIntegers(argumentInput);
default -> Stream.empty();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public TypeSwapPatternParser(WorldEdit worldEdit) {
}

@Override
public Stream<String> getSuggestions(String argumentInput, int index) {
public Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index > 2) {
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public Linear3DTransformParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0) {
return worldEdit.getTransformFactory().getSuggestions(argumentInput).stream();
return worldEdit.getTransformFactory().getSuggestions(argumentInput, context).stream();
}
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public LinearTransformParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index == 0) {
return worldEdit.getTransformFactory().getSuggestions(argumentInput).stream();
return worldEdit.getTransformFactory().getSuggestions(argumentInput, context).stream();
}
return Stream.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public OffsetTransformParser(WorldEdit worldEdit) {
}

@Override
protected Stream<String> getSuggestions(String argumentInput, int index) {
protected Stream<String> getSuggestions(String argumentInput, int index, ParserContext context) {
if (index < 3) {
return SuggestionHelper.suggestPositiveIntegers(argumentInput);
} else if (index == 3) {
return worldEdit.getTransformFactory().getSuggestions(argumentInput).stream();
return worldEdit.getTransformFactory().getSuggestions(argumentInput, context).stream();
}
return Stream.empty();
}
Expand Down
Loading

0 comments on commit 5ac4d2f

Please sign in to comment.