geforkt von Mirrors/FastAsyncWorldEdit
RandomPatternParser is an upstream class
Dieser Commit ist enthalten in:
Ursprung
7f61483609
Commit
527b7141a3
@ -42,7 +42,7 @@ import com.fastasyncworldedit.core.extension.factory.parser.pattern.OffsetPatter
|
|||||||
import com.fastasyncworldedit.core.extension.factory.parser.pattern.PerlinPatternParser;
|
import com.fastasyncworldedit.core.extension.factory.parser.pattern.PerlinPatternParser;
|
||||||
import com.fastasyncworldedit.core.extension.factory.parser.pattern.RandomFullClipboardPatternParser;
|
import com.fastasyncworldedit.core.extension.factory.parser.pattern.RandomFullClipboardPatternParser;
|
||||||
import com.fastasyncworldedit.core.extension.factory.parser.pattern.RandomOffsetPatternParser;
|
import com.fastasyncworldedit.core.extension.factory.parser.pattern.RandomOffsetPatternParser;
|
||||||
import com.fastasyncworldedit.core.extension.factory.parser.pattern.RandomPatternParser;
|
import com.sk89q.worldedit.extension.factory.parser.pattern.RandomPatternParser;
|
||||||
import com.fastasyncworldedit.core.extension.factory.parser.pattern.RelativePatternParser;
|
import com.fastasyncworldedit.core.extension.factory.parser.pattern.RelativePatternParser;
|
||||||
import com.fastasyncworldedit.core.extension.factory.parser.pattern.RichPatternParser;
|
import com.fastasyncworldedit.core.extension.factory.parser.pattern.RichPatternParser;
|
||||||
import com.fastasyncworldedit.core.extension.factory.parser.pattern.RidgedMultiFractalPatternParser;
|
import com.fastasyncworldedit.core.extension.factory.parser.pattern.RidgedMultiFractalPatternParser;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.fastasyncworldedit.core.extension.factory.parser.pattern;
|
package com.sk89q.worldedit.extension.factory.parser.pattern;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.configuration.Caption;
|
import com.fastasyncworldedit.core.configuration.Caption;
|
||||||
import com.sk89q.util.StringUtil;
|
import com.sk89q.util.StringUtil;
|
||||||
@ -26,9 +26,8 @@ public class RandomPatternParser extends InputParser<Pattern> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stream<String> getSuggestions(String input) {
|
public Stream<String> getSuggestions(String input) {
|
||||||
|
//FAWE start
|
||||||
List<String> patterns = StringUtil.split(input, ',', '[', ']');
|
List<String> patterns = StringUtil.split(input, ',', '[', ']');
|
||||||
/*String[] splits = input.split(",", -1);
|
|
||||||
List<String> patterns = StringUtil.parseListInQuotes(splits, ',', '[', ']', true);*/
|
|
||||||
if (patterns.size() == 1) {
|
if (patterns.size() == 1) {
|
||||||
return Stream.empty();
|
return Stream.empty();
|
||||||
}
|
}
|
||||||
@ -37,7 +36,6 @@ public class RandomPatternParser extends InputParser<Pattern> {
|
|||||||
String previous = String.join(",", patterns.subList(0, patterns.size() - 1));
|
String previous = String.join(",", patterns.subList(0, patterns.size() - 1));
|
||||||
if (token.matches("[0-9]+(\\.[0-9]*)?%.*")) {
|
if (token.matches("[0-9]+(\\.[0-9]*)?%.*")) {
|
||||||
String[] p = token.split("%");
|
String[] p = token.split("%");
|
||||||
|
|
||||||
if (p.length < 2) {
|
if (p.length < 2) {
|
||||||
return Stream.empty();
|
return Stream.empty();
|
||||||
} else {
|
} else {
|
||||||
@ -46,15 +44,16 @@ public class RandomPatternParser extends InputParser<Pattern> {
|
|||||||
}
|
}
|
||||||
final List<String> innerSuggestions = worldEdit.getPatternFactory().getSuggestions(token);
|
final List<String> innerSuggestions = worldEdit.getPatternFactory().getSuggestions(token);
|
||||||
return innerSuggestions.stream().map(s -> previous + "," + s);
|
return innerSuggestions.stream().map(s -> previous + "," + s);
|
||||||
|
//FAWE end
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pattern parseFromInput(String input, ParserContext context) throws InputParseException {
|
public Pattern parseFromInput(String input, ParserContext context) throws InputParseException {
|
||||||
RandomPattern randomPattern = new RandomPattern();
|
RandomPattern randomPattern = new RandomPattern();
|
||||||
|
|
||||||
|
//FAWE start
|
||||||
List<String> patterns = StringUtil.split(input, ',', '[', ']');
|
List<String> patterns = StringUtil.split(input, ',', '[', ']');
|
||||||
/*String[] splits = input.split(",", -1);
|
//FAWE end
|
||||||
List<String> patterns = StringUtil.parseListInQuotes(splits, ',', '[', ']', true);*/
|
|
||||||
if (patterns.size() == 1) {
|
if (patterns.size() == 1) {
|
||||||
return null; // let a 'single'-pattern parser handle it
|
return null; // let a 'single'-pattern parser handle it
|
||||||
}
|
}
|
||||||
@ -64,7 +63,9 @@ public class RandomPatternParser extends InputParser<Pattern> {
|
|||||||
|
|
||||||
// Parse special percentage syntax
|
// Parse special percentage syntax
|
||||||
if (token.matches("[0-9]+(\\.[0-9]*)?%.*")) {
|
if (token.matches("[0-9]+(\\.[0-9]*)?%.*")) {
|
||||||
|
//FAWE start
|
||||||
String[] p = token.split("%", 2);
|
String[] p = token.split("%", 2);
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
if (p.length < 2) {
|
if (p.length < 2) {
|
||||||
throw new InputParseException(Caption.of(
|
throw new InputParseException(Caption.of(
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren