3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-27 08:30:12 +01:00

Gatekeep RequestAbilityPackets to 1.19.30+

Dieser Commit ist enthalten in:
Camotoy 2022-09-18 12:20:54 -04:00
Ursprung 64c03b9610
Commit 4e2d750791
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
2 geänderte Dateien mit 10 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -95,6 +95,10 @@ public final class GameProtocol {
return session.getUpstream().getProtocolVersion() >= Bedrock_v534.V534_CODEC.getProtocolVersion(); 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. * Gets the {@link PacketCodec} for Minecraft: Java Edition.
* *

Datei anzeigen

@ -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.Ability;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.RequestAbilityPacket; import com.nukkitx.protocol.bedrock.packet.RequestAbilityPacket;
import org.geysermc.geyser.network.GameProtocol;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.protocol.Translator;
@ -42,6 +43,11 @@ public class BedrockRequestAbilityTranslator extends PacketTranslator<RequestAbi
@Override @Override
public void translate(GeyserSession session, RequestAbilityPacket packet) { 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) { if (packet.getAbility() == Ability.FLYING) {
handle(session, packet.isBoolValue()); handle(session, packet.isBoolValue());
} }