mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Fix tab completion of % (random) pattern removing the % part of the input
This commit is contained in:
parent
5692ec54dd
commit
9bf9885ffb
@ -33,17 +33,20 @@ public class RandomPatternParser extends InputParser<Pattern> {
|
|||||||
}
|
}
|
||||||
// get suggestions for the last token only
|
// get suggestions for the last token only
|
||||||
String token = patterns.get(patterns.size() - 1);
|
String token = patterns.get(patterns.size() - 1);
|
||||||
|
String randString = "";
|
||||||
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 {
|
||||||
|
randString = p[0];
|
||||||
token = p[1];
|
token = p[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final List<String> innerSuggestions = worldEdit.getPatternFactory().getSuggestions(token);
|
final List<String> innerSuggestions = worldEdit.getPatternFactory().getSuggestions(token);
|
||||||
return innerSuggestions.stream().map(s -> previous + "," + s);
|
String prev = previous + "," + randString + "%";
|
||||||
|
return innerSuggestions.stream().map(s -> prev + s);
|
||||||
//FAWE end
|
//FAWE end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user