Skip to content

Commit

Permalink
Fix spawn-elytra being removed when sneaking while falling
Browse files Browse the repository at this point in the history
  • Loading branch information
booky10 committed Oct 28, 2023
1 parent a522776 commit 0163bc3
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public void onLaunchPlateUse(LaunchPlateUseEvent event) {
this.manager.giveElytra(event.getPlayer());
}

@SuppressWarnings("deprecation") // doesn't matter
@EventHandler
public void onElytraChange(EntityPoseChangeEvent event) {
if (!(event.getEntity() instanceof Player player)) {
Expand All @@ -99,6 +100,10 @@ public void onElytraChange(EntityPoseChangeEvent event) {
return;
}

if (player.getPose() != Pose.FALL_FLYING && !player.isOnGround()) {
return; // prevents elytra being removed when sneaking while falling
}

if (this.manager.inElytraBox(player.getLocation())
|| this.launchPlateDelay.getIfPresent(player) != null) {
return;
Expand Down

0 comments on commit 0163bc3

Please sign in to comment.