Extract protocollib method detection

This commit is contained in:
games647
2021-07-14 16:33:18 +02:00
parent 864e551a88
commit 0515ac193d

View File

@ -80,7 +80,7 @@ public class ProtocolLibListener extends PacketAdapter {
return;
}
if (packetEvent.getPacket().getMeta(SOURCE_META_KEY).map(val -> val.equals(plugin.getName())).orElse(false)) {
if (isFastLoginPacket(packetEvent)) {
// this is our own packet
return;
}
@ -99,6 +99,12 @@ public class ProtocolLibListener extends PacketAdapter {
}
}
private Boolean isFastLoginPacket(PacketEvent packetEvent) {
return packetEvent.getPacket().getMeta(SOURCE_META_KEY)
.map(val -> val.equals(plugin.getName()))
.orElse(false);
}
private void onEncryptionBegin(PacketEvent packetEvent, Player sender) {
byte[] sharedSecret = packetEvent.getPacket().getByteArrays().read(0);