Should also handle disconnect

This commit is contained in:
Adrian Bergqvist 2022-08-24 22:49:09 +02:00
parent cd952139bc
commit 52a818b109
No known key found for this signature in database
GPG Key ID: FAE7D8EDE225E686
4 changed files with 16 additions and 4 deletions

View File

@ -4,7 +4,7 @@ plugins {
}
group 'org.adde0109'
version '0.5.0'
version '0.4.0-reset'
repositories {
maven {

View File

@ -23,7 +23,7 @@ import org.slf4j.Logger;
import java.nio.file.Path;
import java.util.*;
@Plugin(id = "ambassador", name = "Ambassador", version = "0.4.0", authors = {"adde0109"})
@Plugin(id = "ambassador", name = "Ambassador", version = "0.4.0-reset", authors = {"adde0109"})
public class Ambassador {
public ProxyServer server;

View File

@ -73,6 +73,7 @@ public class ForgeConnection {
int packetID = ProtocolUtils.readVarInt(clientModListPacket);
String[] mods = ProtocolUtils.readStringArray(clientModListPacket);
resettable = Arrays.stream(mods).anyMatch((s) -> s.equals("clientresetpacket"));
clientModListPacket.release();
}
});
//This gets also sent to vanilla

View File

@ -140,7 +140,7 @@ public class ForgeServerSwitchHandler {
private class ReSyncHandler implements MinecraftSessionHandler {
private final Player player;
private final ConnectedPlayer player;
private final MinecraftConnection connection;
private final Future<ForgeHandshakeUtils.CachedServerHandshake> handshakeFuture;
@ -159,7 +159,7 @@ public class ForgeServerSwitchHandler {
@Override
public boolean handle(LoginPluginResponse packet) {
if (!inTransit.removeIf((s) -> s==packet.getId())) {
if (!inTransit.removeIf((s) -> s == packet.getId())) {
if (packet.getId() == 98) {
ForgeHandshakeUtils.CachedServerHandshake handshake;
try {
@ -188,6 +188,7 @@ public class ForgeServerSwitchHandler {
}
connection.flush();
}
private void complete() {
VelocityConfiguration configuration = (VelocityConfiguration) ambassador.server.getConfiguration();
UUID playerUniqueId = player.getUniqueId();
@ -202,5 +203,15 @@ public class ForgeServerSwitchHandler {
connection.setSessionHandler(originalHandler);
continuation.resume();
}
@Override
public void handleUnknown(ByteBuf buf) {
originalHandler.handleUnknown(buf);
}
@Override
public void disconnected() {
originalHandler.disconnected();
}
}
}