Skip to content

Commit 0f31b4b

Browse files
committed
Don't enable fly mode on login when player is in water
shouldFly() treats water as unsafe blocks, which incorrectly triggered fly mode for players logging in while swimming. Guard the isInWater() call behind a version check since the method was added in 1.17. Fixes #6198
1 parent 218e004 commit 0f31b4b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@ private void joinFlow(final User user, final long currentTime, final String mess
505505

506506
if (user.isAuthorized("essentials.fly.safelogin")) {
507507
user.getBase().setFallDistance(0);
508-
if (LocationUtil.shouldFly(ess, user.getLocation())) {
508+
final boolean inWater = VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_17_R01) && user.getBase().isInWater();
509+
if (!inWater && LocationUtil.shouldFly(ess, user.getLocation())) {
509510
user.getBase().setAllowFlight(true);
510511
user.getBase().setFlying(true);
511512
if (ess.getSettings().isSendFlyEnableOnJoin()) {

0 commit comments

Comments
 (0)