Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,12 @@ public void packetReceived(Session session, Packet packet) {
} else if (packet instanceof ClientboundStartConfigurationPacket) {
session.send(new ServerboundConfigurationAcknowledgedPacket());
} else if (packet instanceof ClientboundTransferPacket transferPacket) {
TcpClientSession newSession = new TcpClientSession(transferPacket.getHost(), transferPacket.getPort(), session.getPacketProtocol());
newSession.setFlags(session.getFlags());
session.disconnect("Transferring");
newSession.connect(true, true);
if (session.getFlag(MinecraftConstants.FOLLOW_TRANFERS, true)) {
TcpClientSession newSession = new TcpClientSession(transferPacket.getHost(), transferPacket.getPort(), session.getPacketProtocol());
newSession.setFlags(session.getFlags());
session.disconnect("Transferring");
newSession.connect(true, true);
}
}
} else if (protocol.getState() == ProtocolState.CONFIGURATION) {
if (packet instanceof ClientboundFinishConfigurationPacket) {
Expand All @@ -140,10 +142,12 @@ public void packetReceived(Session session, Packet packet) {
session.send(new ServerboundSelectKnownPacks(Collections.emptyList()));
}
} else if (packet instanceof ClientboundTransferPacket transferPacket) {
TcpClientSession newSession = new TcpClientSession(transferPacket.getHost(), transferPacket.getPort(), session.getPacketProtocol());
newSession.setFlags(session.getFlags());
session.disconnect("Transferring");
newSession.connect(true, true);
if (session.getFlag(MinecraftConstants.FOLLOW_TRANFERS, true)) {
TcpClientSession newSession = new TcpClientSession(transferPacket.getHost(), transferPacket.getPort(), session.getPacketProtocol());
newSession.setFlags(session.getFlags());
session.disconnect("Transferring");
newSession.connect(true, true);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public final class MinecraftConstants {
*/
public static final Flag<Boolean> SEND_BLANK_KNOWN_PACKS_RESPONSE = new Flag<>("send-blank-known-packs-response", Boolean.class);

/**
* Session flag for determining whether to create a new TcpClientSession when the Java server sends a ClientboundTransferPacket.
*/
public static final Flag<Boolean> FOLLOW_TRANFERS = new Flag<>("follow-transfers", Boolean.class);

// Server Key Constants

/**
Expand Down