mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-23 15:00:37 +01:00
Gatekeep RequestAbilityPackets to 1.19.30+
This commit is contained in:
parent
64c03b9610
commit
4e2d750791
2 changed files with 10 additions and 0 deletions
|
@ -95,6 +95,10 @@ public final class GameProtocol {
|
|||
return session.getUpstream().getProtocolVersion() >= Bedrock_v534.V534_CODEC.getProtocolVersion();
|
||||
}
|
||||
|
||||
public static boolean supports1_19_30(GeyserSession session) {
|
||||
return session.getUpstream().getProtocolVersion() >= Bedrock_v554.V554_CODEC.getProtocolVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link PacketCodec} for Minecraft: Java Edition.
|
||||
*
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server
|
|||
import com.nukkitx.protocol.bedrock.data.Ability;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||
import com.nukkitx.protocol.bedrock.packet.RequestAbilityPacket;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.Translator;
|
||||
|
@ -42,6 +43,11 @@ public class BedrockRequestAbilityTranslator extends PacketTranslator<RequestAbi
|
|||
|
||||
@Override
|
||||
public void translate(GeyserSession session, RequestAbilityPacket packet) {
|
||||
// Gatekeep to 1.19.30 so older versions don't fire twice
|
||||
if (!GameProtocol.supports1_19_30(session)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet.getAbility() == Ability.FLYING) {
|
||||
handle(session, packet.isBoolValue());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue