mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-10-31 23:59:33 +01:00
Fix toggleglide listener swimming check
This commit is contained in:
parent
b57800c2e2
commit
653ca4b322
@ -18,8 +18,15 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
public class EntityToggleGlideListener extends ViaBukkitListener {
|
public class EntityToggleGlideListener extends ViaBukkitListener {
|
||||||
|
|
||||||
|
private boolean swimmingMethodExists;
|
||||||
|
|
||||||
public EntityToggleGlideListener(ViaVersionPlugin plugin) {
|
public EntityToggleGlideListener(ViaVersionPlugin plugin) {
|
||||||
super(plugin, Protocol1_15To1_14_4.class);
|
super(plugin, Protocol1_15To1_14_4.class);
|
||||||
|
try {
|
||||||
|
Player.class.getMethod("isSwimming");
|
||||||
|
swimmingMethodExists = true;
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
@ -47,7 +54,7 @@ public class EntityToggleGlideListener extends ViaBukkitListener {
|
|||||||
if (player.isSprinting()) {
|
if (player.isSprinting()) {
|
||||||
bitmask |= 0x08;
|
bitmask |= 0x08;
|
||||||
}
|
}
|
||||||
if (player.isSwimming()) {
|
if (swimmingMethodExists && player.isSwimming()) {
|
||||||
bitmask |= 0x10;
|
bitmask |= 0x10;
|
||||||
}
|
}
|
||||||
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
|
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user