geforkt von Mirrors/FastAsyncWorldEdit
Slight readability and usability improvements.
Also no longer allows trailing strings (e.g. //set #clipboardasdf).
Dieser Commit ist enthalten in:
Ursprung
19796aa3be
Commit
287be0209c
@ -47,26 +47,22 @@ public class ClipboardPatternParser extends InputParser<Pattern> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pattern parseFromInput(String input, ParserContext context) throws InputParseException {
|
public Pattern parseFromInput(String input, ParserContext context) throws InputParseException {
|
||||||
if (!input.startsWith("#clipboard") && !input.startsWith("#copy")) {
|
String[] offsetParts = input.split("@", 2);
|
||||||
|
if (!offsetParts[0].equalsIgnoreCase("#clipboard") && !offsetParts[0].equalsIgnoreCase("#copy")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
LocalSession session = context.requireSession();
|
LocalSession session = context.requireSession();
|
||||||
|
|
||||||
int offsetPart;
|
|
||||||
BlockVector3 offset = BlockVector3.ZERO;
|
BlockVector3 offset = BlockVector3.ZERO;
|
||||||
if ((offsetPart = input.indexOf('@')) >= 0) {
|
if (offsetParts.length == 2) {
|
||||||
if (input.length() <= offsetPart + 1) {
|
String[] offsetSplit = offsetParts[1].split(",");
|
||||||
throw new InputParseException("Clipboard offset coordinates not specified!");
|
if (offsetSplit.length != 3) {
|
||||||
}
|
|
||||||
String offsetString = input.substring(offsetPart + 1);
|
|
||||||
String[] offsetCoords = offsetString.split(",");
|
|
||||||
if (offsetCoords.length != 3) {
|
|
||||||
throw new InputParseException("Clipboard offset needs x,y,z coordinates.");
|
throw new InputParseException("Clipboard offset needs x,y,z coordinates.");
|
||||||
}
|
}
|
||||||
offset = BlockVector3.at(
|
offset = BlockVector3.at(
|
||||||
Integer.valueOf(offsetCoords[0]),
|
Integer.valueOf(offsetSplit[0]),
|
||||||
Integer.valueOf(offsetCoords[1]),
|
Integer.valueOf(offsetSplit[1]),
|
||||||
Integer.valueOf(offsetCoords[2])
|
Integer.valueOf(offsetSplit[2])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren