mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Merge 257c69dea2 into cd897feb1b
This commit is contained in:
commit
d6f32e18d5
3 changed files with 9 additions and 22 deletions
|
|
@ -35,6 +35,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.geysermc.mcprotocollib.network.BuiltinFlags;
|
import org.geysermc.mcprotocollib.network.BuiltinFlags;
|
||||||
import org.geysermc.mcprotocollib.network.codec.PacketCodecHelper;
|
import org.geysermc.mcprotocollib.network.codec.PacketCodecHelper;
|
||||||
import org.geysermc.mcprotocollib.network.packet.PacketProtocol;
|
import org.geysermc.mcprotocollib.network.packet.PacketProtocol;
|
||||||
|
import org.geysermc.mcprotocollib.network.tcp.TcpFlowControlHandler;
|
||||||
import org.geysermc.mcprotocollib.network.tcp.TcpPacketCodec;
|
import org.geysermc.mcprotocollib.network.tcp.TcpPacketCodec;
|
||||||
import org.geysermc.mcprotocollib.network.tcp.TcpPacketSizer;
|
import org.geysermc.mcprotocollib.network.tcp.TcpPacketSizer;
|
||||||
import org.geysermc.mcprotocollib.network.tcp.TcpSession;
|
import org.geysermc.mcprotocollib.network.tcp.TcpSession;
|
||||||
|
|
@ -90,6 +91,8 @@ public final class LocalSession extends TcpSession {
|
||||||
|
|
||||||
ChannelPipeline pipeline = channel.pipeline();
|
ChannelPipeline pipeline = channel.pipeline();
|
||||||
pipeline.addLast("sizer", new TcpPacketSizer(LocalSession.this, protocol.getPacketHeader().getLengthSize()));
|
pipeline.addLast("sizer", new TcpPacketSizer(LocalSession.this, protocol.getPacketHeader().getLengthSize()));
|
||||||
|
|
||||||
|
pipeline.addLast("flow-control", new TcpFlowControlHandler());
|
||||||
pipeline.addLast("codec", new TcpPacketCodec(LocalSession.this, true));
|
pipeline.addLast("codec", new TcpPacketCodec(LocalSession.this, true));
|
||||||
pipeline.addLast("manager", LocalSession.this);
|
pipeline.addLast("manager", LocalSession.this);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -905,7 +905,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
// Start ticking
|
// Start ticking
|
||||||
tickThread = eventLoop.scheduleAtFixedRate(this::tick, 50, 50, TimeUnit.MILLISECONDS);
|
tickThread = eventLoop.scheduleAtFixedRate(this::tick, 50, 50, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
this.protocol.setUseDefaultListeners(false);
|
this.protocol.setUseDefaultListeners(true);
|
||||||
|
|
||||||
TcpSession downstream;
|
TcpSession downstream;
|
||||||
if (geyser.getBootstrap().getSocketAddress() != null) {
|
if (geyser.getBootstrap().getSocketAddress() != null) {
|
||||||
|
|
@ -942,22 +942,6 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
// We'll handle this since we have the registry data on hand
|
// We'll handle this since we have the registry data on hand
|
||||||
downstream.setFlag(MinecraftConstants.SEND_BLANK_KNOWN_PACKS_RESPONSE, false);
|
downstream.setFlag(MinecraftConstants.SEND_BLANK_KNOWN_PACKS_RESPONSE, false);
|
||||||
|
|
||||||
// This isn't a great solution, but... we want to make sure the finish configuration packet cannot be sent
|
|
||||||
// before the KnownPacks packet.
|
|
||||||
this.downstream.getSession().addListener(new ClientListener(ProtocolState.LOGIN, loginEvent.transferring()) {
|
|
||||||
@Override
|
|
||||||
public void packetReceived(Session session, Packet packet) {
|
|
||||||
if (protocol.getState() == ProtocolState.CONFIGURATION) {
|
|
||||||
if (packet instanceof ClientboundFinishConfigurationPacket) {
|
|
||||||
// Prevent
|
|
||||||
GeyserSession.this.ensureInEventLoop(() -> GeyserSession.this.sendDownstreamPacket(new ServerboundFinishConfigurationPacket()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.packetReceived(session, packet);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
downstream.addListener(new SessionAdapter() {
|
downstream.addListener(new SessionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void packetSending(PacketSendingEvent event) {
|
public void packetSending(PacketSendingEvent event) {
|
||||||
|
|
@ -1719,8 +1703,8 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (protocol.getState() != intendedState) {
|
if (protocol.getOutboundState() != intendedState) {
|
||||||
geyser.getLogger().debug("Tried to send " + packet.getClass().getSimpleName() + " packet while not in " + intendedState.name() + " state");
|
geyser.getLogger().debug("Tried to send " + packet.getClass().getSimpleName() + " packet while not in " + intendedState.name() + " outbound state");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1754,7 +1738,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendDownstreamPacket0(Packet packet) {
|
private void sendDownstreamPacket0(Packet packet) {
|
||||||
ProtocolState state = protocol.getState();
|
ProtocolState state = protocol.getOutboundState();
|
||||||
if (state == ProtocolState.GAME || state == ProtocolState.CONFIGURATION || packet.getClass() == ServerboundCustomQueryAnswerPacket.class) {
|
if (state == ProtocolState.GAME || state == ProtocolState.CONFIGURATION || packet.getClass() == ServerboundCustomQueryAnswerPacket.class) {
|
||||||
downstream.sendPacket(packet);
|
downstream.sendPacket(packet);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ websocket = "1.5.1"
|
||||||
protocol = "3.0.0.Beta2-20240704.153116-14"
|
protocol = "3.0.0.Beta2-20240704.153116-14"
|
||||||
raknet = "1.0.0.CR3-20240416.144209-1"
|
raknet = "1.0.0.CR3-20240416.144209-1"
|
||||||
minecraftauth = "4.1.0"
|
minecraftauth = "4.1.0"
|
||||||
mcprotocollib = "1.21-20240725.013034-16"
|
mcprotocollib = "576b311"
|
||||||
adventure = "4.14.0"
|
adventure = "4.14.0"
|
||||||
adventure-platform = "4.3.0"
|
adventure-platform = "4.3.0"
|
||||||
junit = "5.9.2"
|
junit = "5.9.2"
|
||||||
|
|
@ -117,7 +117,7 @@ guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
|
||||||
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
||||||
junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
|
junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
|
||||||
minecraftauth = { group = "net.raphimc", name = "MinecraftAuth", version.ref = "minecraftauth" }
|
minecraftauth = { group = "net.raphimc", name = "MinecraftAuth", version.ref = "minecraftauth" }
|
||||||
mcprotocollib = { group = "org.geysermc.mcprotocollib", name = "protocol", version.ref = "mcprotocollib" }
|
mcprotocollib = { group = "com.github.AlexProgrammerDE", name = "MCProtocolLib", version.ref = "mcprotocollib" }
|
||||||
raknet = { group = "org.cloudburstmc.netty", name = "netty-transport-raknet", version.ref = "raknet" }
|
raknet = { group = "org.cloudburstmc.netty", name = "netty-transport-raknet", version.ref = "raknet" }
|
||||||
terminalconsoleappender = { group = "net.minecrell", name = "terminalconsoleappender", version.ref = "terminalconsoleappender" }
|
terminalconsoleappender = { group = "net.minecrell", name = "terminalconsoleappender", version.ref = "terminalconsoleappender" }
|
||||||
velocity-api = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
|
velocity-api = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue