Set version for ResourcePackStackPacket

This commit is contained in:
RednedEpic 2019-11-02 16:14:28 -05:00 committed by RednedEpic
parent a4b2a016f8
commit 18c13067b8

View file

@ -45,7 +45,6 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
@Override @Override
public boolean handle(LoginPacket loginPacket) { public boolean handle(LoginPacket loginPacket) {
// TODO: Implement support for multiple protocols
if (loginPacket.getProtocolVersion() != GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion()) { if (loginPacket.getProtocolVersion() != GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion()) {
connector.getLogger().debug("unsupported"); connector.getLogger().debug("unsupported");
session.getUpstream().disconnect("Unsupported Bedrock version. Are you running an outdated version?"); session.getUpstream().disconnect("Unsupported Bedrock version. Are you running an outdated version?");
@ -56,16 +55,16 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
PlayStatusPacket playStatus = new PlayStatusPacket(); PlayStatusPacket playStatus = new PlayStatusPacket();
playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS); playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS);
session.getUpstream().sendPacketImmediately(playStatus); session.getUpstream().sendPacket(playStatus);
ResourcePacksInfoPacket resourcePacksInfo = new ResourcePacksInfoPacket(); ResourcePacksInfoPacket resourcePacksInfo = new ResourcePacksInfoPacket();
session.getUpstream().sendPacketImmediately(resourcePacksInfo); session.getUpstream().sendPacket(resourcePacksInfo);
return true; return true;
} }
@Override @Override
public boolean handle(ResourcePackClientResponsePacket textPacket) { public boolean handle(ResourcePackClientResponsePacket packet) {
switch (textPacket.getStatus()) { switch (packet.getStatus()) {
case COMPLETED: case COMPLETED:
session.connect(connector.getRemoteServer()); session.connect(connector.getRemoteServer());
connector.getLogger().info("Player connected with username " + session.getAuthenticationData().getName()); connector.getLogger().info("Player connected with username " + session.getAuthenticationData().getName());
@ -74,7 +73,8 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
ResourcePackStackPacket stack = new ResourcePackStackPacket(); ResourcePackStackPacket stack = new ResourcePackStackPacket();
stack.setExperimental(false); stack.setExperimental(false);
stack.setForcedToAccept(false); stack.setForcedToAccept(false);
session.getUpstream().sendPacketImmediately(stack); stack.setGameVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getMinecraftVersion());
session.getUpstream().sendPacket(stack);
break; break;
default: default:
session.getUpstream().disconnect("disconnectionScreen.resourcePack"); session.getUpstream().disconnect("disconnectionScreen.resourcePack");