Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "vector from" syntax conflict by making ExprVectorFromDirection parse later. #6383

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
public class ExprLocationFromVector extends SimpleExpression<Location> {

static {
Skript.registerExpression(ExprLocationFromVector.class, Location.class, ExpressionType.SIMPLE,
Skript.registerExpression(ExprLocationFromVector.class, Location.class, ExpressionType.COMBINED,
"%vector% to location in %world%",
"location (from|of) %vector% in %world%",
"%vector% [to location] in %world% with yaw %number% and pitch %number%",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
public class ExprLocationVectorOffset extends SimpleExpression<Location> {

static {
Skript.registerExpression(ExprLocationVectorOffset.class, Location.class, ExpressionType.SIMPLE,
Skript.registerExpression(ExprLocationVectorOffset.class, Location.class, ExpressionType.COMBINED,
"%location% offset by [[the] vectors] %vectors%",
"%location%[ ]~[~][ ]%vectors%");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
public class ExprVectorAngleBetween extends SimpleExpression<Number> {

static {
Skript.registerExpression(ExprVectorAngleBetween.class, Number.class, ExpressionType.SIMPLE,
Skript.registerExpression(ExprVectorAngleBetween.class, Number.class, ExpressionType.COMBINED,
"[the] angle between [[the] vectors] %vector% and %vector%");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
public class ExprVectorBetweenLocations extends SimpleExpression<Vector> {

static {
Skript.registerExpression(ExprVectorBetweenLocations.class, Vector.class, ExpressionType.SIMPLE,
Skript.registerExpression(ExprVectorBetweenLocations.class, Vector.class, ExpressionType.COMBINED,
"[the] vector (from|between) %location% (to|and) %location%");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
public class ExprVectorCrossProduct extends SimpleExpression<Vector> {

static {
Skript.registerExpression(ExprVectorCrossProduct.class, Vector.class, ExpressionType.SIMPLE, "%vector% cross %vector%");
Skript.registerExpression(ExprVectorCrossProduct.class, Vector.class, ExpressionType.COMBINED, "%vector% cross %vector%");
}

@SuppressWarnings("null")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
public class ExprVectorCylindrical extends SimpleExpression<Vector> {

static {
Skript.registerExpression(ExprVectorCylindrical.class, Vector.class, ExpressionType.SIMPLE,
Skript.registerExpression(ExprVectorCylindrical.class, Vector.class, ExpressionType.COMBINED,
"[a] [new] cylindrical vector [(from|with)] [radius] %number%, [yaw] %number%(,| and) [height] %number%");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
public class ExprVectorDotProduct extends SimpleExpression<Number> {

static {
Skript.registerExpression(ExprVectorDotProduct.class, Number.class, ExpressionType.SIMPLE, "%vector% dot %vector%");
Skript.registerExpression(ExprVectorDotProduct.class, Number.class, ExpressionType.COMBINED, "%vector% dot %vector%");
}

@SuppressWarnings("null")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
public class ExprVectorFromDirection extends SimpleExpression<Vector> {

static {
Skript.registerExpression(ExprVectorFromDirection.class, Vector.class, ExpressionType.SIMPLE,
Skript.registerExpression(ExprVectorFromDirection.class, Vector.class, ExpressionType.PROPERTY,
"vector[s] [from] %directions%",
"%directions% vector[s]");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
public class ExprVectorFromXYZ extends SimpleExpression<Vector> {

static {
Skript.registerExpression(ExprVectorFromXYZ.class, Vector.class, ExpressionType.SIMPLE,
Skript.registerExpression(ExprVectorFromXYZ.class, Vector.class, ExpressionType.COMBINED,
"[a] [new] vector [(from|at|to)] %number%,[ ]%number%(,[ ]| and )%number%");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
public class ExprVectorFromYawAndPitch extends SimpleExpression<Vector> {

static {
Skript.registerExpression(ExprVectorFromYawAndPitch.class, Vector.class, ExpressionType.SIMPLE,
Skript.registerExpression(ExprVectorFromYawAndPitch.class, Vector.class, ExpressionType.COMBINED,
"[a] [new] vector (from|with) yaw %number% and pitch %number%");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
public class ExprVectorNormalize extends SimpleExpression<Vector> {

static {
Skript.registerExpression(ExprVectorNormalize.class, Vector.class, ExpressionType.SIMPLE,
Skript.registerExpression(ExprVectorNormalize.class, Vector.class, ExpressionType.COMBINED,
"normalize[d] %vector%",
"%vector% normalized");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
public class ExprVectorOfLocation extends SimpleExpression<Vector> {

static {
Skript.registerExpression(ExprVectorOfLocation.class, Vector.class, ExpressionType.SIMPLE,
Skript.registerExpression(ExprVectorOfLocation.class, Vector.class, ExpressionType.PROPERTY,
"[the] vector (of|from|to) %location%",
"%location%'s vector");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
public class ExprVectorSpherical extends SimpleExpression<Vector> {

static {
Skript.registerExpression(ExprVectorSpherical.class, Vector.class, ExpressionType.SIMPLE,
Skript.registerExpression(ExprVectorSpherical.class, Vector.class, ExpressionType.COMBINED,
"[new] spherical vector [(from|with)] [radius] %number%, [yaw] %number%(,| and) [pitch] %number%");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test "vector from expressions conflict":
set {_x} to 1
set {_y} to 2
set {_z} to -3
set {_v} to vector from {_x}, {_y}, {_z}
set {_v2} to vector({_x}, {_y}, {_z})
assert {_v} is {_v2} with "Vector from not generating correct vector. Expected %{_v2}%, got %{_v}%"
Loading