3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-09 13:00:05 +01:00

Reformat, fix RichParser suggestions

Dieser Commit ist enthalten in:
IronApollo 2020-09-07 21:46:54 -04:00
Ursprung 7929320611
Commit dc465f7d3c
7 geänderte Dateien mit 58 neuen und 34 gelöschten Zeilen

Datei anzeigen

@ -20,7 +20,32 @@
package com.sk89q.worldedit.extension.factory; package com.sk89q.worldedit.extension.factory;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.factory.parser.mask.*; import com.sk89q.worldedit.extension.factory.parser.mask.AdjacentMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.AirMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.AngleMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.BiomeMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.BlockCategoryMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.BlockStateMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.BlocksMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.ExistingMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.ExpressionMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.ExtremaMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.FalseMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.LazyRegionMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.LiquidMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.NegateMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.NoiseMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.OffsetMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.ROCAngleMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.RegionMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.SimplexMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.SolidMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.SurfaceMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.TrueMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.WallMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.XAxisMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.YAxisMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.ZAxisMaskParser;
import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.NoMatchException;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;

Datei anzeigen

@ -36,7 +36,7 @@ public abstract class RichParser<E> extends InputParser<E> {
@Override @Override
public Stream<String> getSuggestions(String input) { public Stream<String> getSuggestions(String input) {
// we don't even want to start suggesting if it's not meant to be this parser result // we don't even want to start suggesting if it's not meant to be this parser result
if (input.length() > this.required.length() && !input.startsWith(this.required)) { if (input.length() >= this.required.length() && !input.startsWith(this.required)) {
return Stream.empty(); return Stream.empty();
} }
// suggest until the first [ as long as it isn't fully typed // suggest until the first [ as long as it isn't fully typed
@ -45,11 +45,11 @@ public abstract class RichParser<E> extends InputParser<E> {
} }
// we know that it is at least "<required>" // we know that it is at least "<required>"
String[] strings = extractArguments(input.substring(this.prefix.length()), false); String[] strings = extractArguments(input.substring(this.prefix.length()), false);
StringJoiner joiner = new StringJoiner(","); StringBuilder builder = new StringBuilder();
for (int i = 0; i < strings.length - 1; i++) { for (int i = 0; i < strings.length - 1; i++) {
joiner.add("[" + strings[i] + "]"); builder.append('[').append(strings[i]).append(']');
} }
String previous = this.prefix + joiner; String previous = this.prefix + builder;
return getSuggestions(strings[strings.length - 1], strings.length - 1).map(s -> previous + "[" + s + "]"); return getSuggestions(strings[strings.length - 1], strings.length - 1).map(s -> previous + "[" + s + "]");
} }

Datei anzeigen

@ -40,6 +40,6 @@ public class AdjacentMaskParser extends RichParser<Mask> {
if (max >= 8 && min == 1) { if (max >= 8 && min == 1) {
return new AdjacentAnyMask(subMask); return new AdjacentAnyMask(subMask);
} }
return new AdjacentMask(subMask, (int) min, (int) max); return new AdjacentMask(subMask, min, max);
} }
} }

Datei anzeigen

@ -29,7 +29,6 @@ public class RadiusMaskParser extends RichParser<Mask> {
if (arguments.length < 2) return null; if (arguments.length < 2) return null;
int min = Integer.parseInt(arguments[0]); int min = Integer.parseInt(arguments[0]);
int max = Integer.parseInt(arguments[1]); int max = Integer.parseInt(arguments[1]);
System.out.println("radius: " + min + " | " + max);
return new RadiusMask(min, max); return new RadiusMask(min, max);
} }
} }