Skip to content
Open
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 @@ -152,11 +152,19 @@ private boolean validateMode(final @NotNull Player player, final @NotNull Mode m
// is not possible, so we ignore it as well
!player.isInsideVehicle() && !player.isSneaking() && !player.isSwimming() && player.isSprinting()
&& !player.isFlying() && !this.plugin.getVersionSpecificHandler().isPlayerGliding(player);
case FOOT_LIKE ->
// player is sneaking, walking, or running
!player.isInsideVehicle() && !player.isSwimming()
&& !player.isFlying() && !this.plugin.getVersionSpecificHandler().isPlayerGliding(player);
case SWIMMING ->
// sprinting and sneaking is possible with swimming at once,
// so we ignore it but not gliding as it's a bit different
!player.isInsideVehicle() && player.isSwimming()
&& !this.plugin.getVersionSpecificHandler().isPlayerGliding(player);
case MANUAL_MOVEMENT ->
// player is sneaking, walking, running, or swimming
!player.isInsideVehicle()
&& !player.isFlying() && !this.plugin.getVersionSpecificHandler().isPlayerGliding(player);
case FLYING ->
// sprinting and sneaking is possible with flying at once,
// so we ignore it but not gliding as it's a bit different
Expand All @@ -166,6 +174,8 @@ private boolean validateMode(final @NotNull Player player, final @NotNull Mode m
// we can safely ignore any other actions here as there is
// really no better way to detect flying with elytra
!player.isInsideVehicle() && this.plugin.getVersionSpecificHandler().isPlayerGliding(player);

case ANY -> true;
};
}

Expand All @@ -188,9 +198,12 @@ private enum Mode {
SNEAKING,
WALKING,
RUNNING,
FOOT_LIKE,
SWIMMING,
MANUAL_MOVEMENT,
FLYING,
ELYTRA;
ELYTRA,
ANY;

private static final Map<String, Mode> STRING_MODE_MAP = new HashMap<>() {{
for (final Mode mode : Mode.values()) {
Expand Down