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 pitch and yaw in teleport action #1416

Merged
merged 1 commit into from
Oct 29, 2024
Merged
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 @@ -11,21 +11,21 @@ public class TeleportAction extends AbstractAction<MatchPlayer> {
private final Formula<MatchPlayer> xformula;
private final Formula<MatchPlayer> yformula;
private final Formula<MatchPlayer> zformula;
private final Optional<Formula<MatchPlayer>> yawFormula;
private final Optional<Formula<MatchPlayer>> pitchFormula;
private final Optional<Formula<MatchPlayer>> yawFormula;

public TeleportAction(
Formula<MatchPlayer> xformula,
Formula<MatchPlayer> yformula,
Formula<MatchPlayer> zformula,
Optional<Formula<MatchPlayer>> yawFormula,
Optional<Formula<MatchPlayer>> pitchFormula) {
Optional<Formula<MatchPlayer>> pitchFormula,
Optional<Formula<MatchPlayer>> yawFormula) {
super(MatchPlayer.class);
this.xformula = xformula;
this.yformula = yformula;
this.zformula = zformula;
this.yawFormula = yawFormula;
this.pitchFormula = pitchFormula;
this.yawFormula = yawFormula;
}

@Override
Expand All @@ -34,8 +34,8 @@ public void trigger(MatchPlayer player) {
location.setX(xformula.applyAsDouble(player));
location.setY(yformula.applyAsDouble(player));
location.setZ(zformula.applyAsDouble(player));
yawFormula.ifPresent((formula) -> location.setYaw((float) formula.applyAsDouble(player)));
pitchFormula.ifPresent((formula) -> location.setPitch((float) formula.applyAsDouble(player)));
yawFormula.ifPresent((formula) -> location.setYaw((float) formula.applyAsDouble(player)));
player.getBukkit().teleport(location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
}
}