3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Merge pull request #1765 from KennyTV/abstraction

Fix toggleglide listener swimming check
Dieser Commit ist enthalten in:
Myles 2020-05-06 09:03:41 +01:00 committet von GitHub
Commit f3f82c4f1a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -18,8 +18,15 @@ import java.util.Arrays;
public class EntityToggleGlideListener extends ViaBukkitListener {
private boolean swimmingMethodExists;
public EntityToggleGlideListener(ViaVersionPlugin plugin) {
super(plugin, Protocol1_15To1_14_4.class);
try {
Player.class.getMethod("isSwimming");
swimmingMethodExists = true;
} catch (NoSuchMethodException ignored) {
}
}
@EventHandler(priority = EventPriority.MONITOR)
@ -47,7 +54,7 @@ public class EntityToggleGlideListener extends ViaBukkitListener {
if (player.isSprinting()) {
bitmask |= 0x08;
}
if (player.isSwimming()) {
if (swimmingMethodExists && player.isSwimming()) {
bitmask |= 0x10;
}
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) {