Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 02:20:07 +01:00
Reformat, fix RichParser suggestions
Dieser Commit ist enthalten in:
Ursprung
7929320611
Commit
dc465f7d3c
@ -20,7 +20,32 @@
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
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.NoMatchException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
|
@ -36,7 +36,7 @@ public abstract class RichParser<E> extends InputParser<E> {
|
||||
@Override
|
||||
public Stream<String> getSuggestions(String input) {
|
||||
// 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();
|
||||
}
|
||||
// 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>"
|
||||
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++) {
|
||||
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 + "]");
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,6 @@ public class AdjacentMaskParser extends RichParser<Mask> {
|
||||
if (max >= 8 && min == 1) {
|
||||
return new AdjacentAnyMask(subMask);
|
||||
}
|
||||
return new AdjacentMask(subMask, (int) min, (int) max);
|
||||
return new AdjacentMask(subMask, min, max);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ public class RadiusMaskParser extends RichParser<Mask> {
|
||||
if (arguments.length < 2) return null;
|
||||
int min = Integer.parseInt(arguments[0]);
|
||||
int max = Integer.parseInt(arguments[1]);
|
||||
System.out.println("radius: " + min + " | " + max);
|
||||
return new RadiusMask(min, max);
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren