-
-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--------- Co-authored-by: sovdee <[email protected]> Co-authored-by: Moderocky <[email protected]>
- Loading branch information
1 parent
d8664fc
commit 2d4c75c
Showing
6 changed files
with
173 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/ch/njol/skript/bukkitutil/SkriptTeleportFlag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package ch.njol.skript.bukkitutil; | ||
|
||
import io.papermc.paper.entity.TeleportFlag; | ||
import io.papermc.paper.entity.TeleportFlag.EntityState; | ||
import io.papermc.paper.entity.TeleportFlag.Relative; | ||
|
||
/** | ||
* A utility enum for accessing Paper's teleport flags (1.19.4+) | ||
*/ | ||
public enum SkriptTeleportFlag { | ||
|
||
RETAIN_OPEN_INVENTORY(EntityState.RETAIN_OPEN_INVENTORY), | ||
RETAIN_PASSENGERS(EntityState.RETAIN_PASSENGERS), | ||
RETAIN_VEHICLE(EntityState.RETAIN_VEHICLE), | ||
RETAIN_DIRECTION(Relative.PITCH, Relative.YAW), | ||
RETAIN_PITCH(Relative.PITCH), | ||
RETAIN_YAW(Relative.YAW), | ||
RETAIN_MOVEMENT(Relative.X, Relative.Y, Relative.Z), | ||
RETAIN_X(Relative.X), | ||
RETAIN_Y(Relative.Y), | ||
RETAIN_Z(Relative.Z); | ||
|
||
final TeleportFlag[] teleportFlags; | ||
|
||
SkriptTeleportFlag(TeleportFlag... teleportFlags) { | ||
this.teleportFlags = teleportFlags; | ||
} | ||
|
||
public TeleportFlag[] getTeleportFlags() { | ||
return teleportFlags; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
test "teleport": | ||
spawn pig at location(0, 0, 0): | ||
set {_pig} to entity | ||
teleport {_pig} to location(1, 30, 1) | ||
assert location of {_pig} is location(1, 30, 1) with "failed to teleport entity" | ||
delete entity within {_pig} | ||
|
||
test "teleport flags": | ||
spawn pig at location(0, 0, 0): | ||
set {_pig} to entity | ||
spawn pig at location(0, 0, 0): | ||
make entity ride {_pig} | ||
set {_pig2} to entity | ||
teleport {_pig} to location(1, 30, 1) retaining passengers, xyz velocity, and yaw and pitch velocity | ||
assert location of {_pig} is location(1, 30, 1) with "failed to teleport entity" | ||
assert passenger of {_pig} is {_pig2} with "failed to retain passenger" | ||
|
||
delete entity within {_pig2} | ||
delete entity within {_pig} |