Skip to content

Commit

Permalink
Added Vector from Blockface expression
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeGBLP committed Jul 23, 2024
1 parent f28db5b commit 3b392df
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package it.jakegblp.lusk.elements.minecraft.blockface.expressions;

import ch.njol.skript.doc.Description;
import ch.njol.skript.doc.Examples;
import ch.njol.skript.doc.Name;
import ch.njol.skript.doc.Since;
import ch.njol.skript.expressions.base.SimplePropertyExpression;
import org.bukkit.block.BlockFace;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;


@Name("BlockFace - Vector")
@Description("Returns the vector corresponding to the provided blockfaces.")
@Examples({"broadcast vector direction of west face"})
@Since("1.2")
public class ExprBlockFaceVector extends SimplePropertyExpression<BlockFace, Vector> {
static {
register(ExprBlockFaceVector.class, Vector.class, "vector [direction]", "blockfaces");
}

@Override
public @NotNull Class<? extends Vector> getReturnType() {
return Vector.class;
}

@Override
@Nullable
public Vector convert(BlockFace blockFace) {
return blockFace.getDirection();
}

@Override
protected @NotNull String getPropertyName() {
return "vector direction";
}
}

0 comments on commit 3b392df

Please sign in to comment.