Should also handle disconnect
This commit is contained in:
parent
cd952139bc
commit
52a818b109
|
|
@ -4,7 +4,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group 'org.adde0109'
|
group 'org.adde0109'
|
||||||
version '0.5.0'
|
version '0.4.0-reset'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import org.slf4j.Logger;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
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 class Ambassador {
|
||||||
|
|
||||||
public ProxyServer server;
|
public ProxyServer server;
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ public class ForgeConnection {
|
||||||
int packetID = ProtocolUtils.readVarInt(clientModListPacket);
|
int packetID = ProtocolUtils.readVarInt(clientModListPacket);
|
||||||
String[] mods = ProtocolUtils.readStringArray(clientModListPacket);
|
String[] mods = ProtocolUtils.readStringArray(clientModListPacket);
|
||||||
resettable = Arrays.stream(mods).anyMatch((s) -> s.equals("clientresetpacket"));
|
resettable = Arrays.stream(mods).anyMatch((s) -> s.equals("clientresetpacket"));
|
||||||
|
clientModListPacket.release();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//This gets also sent to vanilla
|
//This gets also sent to vanilla
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ public class ForgeServerSwitchHandler {
|
||||||
private class ReSyncHandler implements MinecraftSessionHandler {
|
private class ReSyncHandler implements MinecraftSessionHandler {
|
||||||
|
|
||||||
|
|
||||||
private final Player player;
|
private final ConnectedPlayer player;
|
||||||
|
|
||||||
private final MinecraftConnection connection;
|
private final MinecraftConnection connection;
|
||||||
private final Future<ForgeHandshakeUtils.CachedServerHandshake> handshakeFuture;
|
private final Future<ForgeHandshakeUtils.CachedServerHandshake> handshakeFuture;
|
||||||
|
|
@ -159,7 +159,7 @@ public class ForgeServerSwitchHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(LoginPluginResponse packet) {
|
public boolean handle(LoginPluginResponse packet) {
|
||||||
if (!inTransit.removeIf((s) -> s==packet.getId())) {
|
if (!inTransit.removeIf((s) -> s == packet.getId())) {
|
||||||
if (packet.getId() == 98) {
|
if (packet.getId() == 98) {
|
||||||
ForgeHandshakeUtils.CachedServerHandshake handshake;
|
ForgeHandshakeUtils.CachedServerHandshake handshake;
|
||||||
try {
|
try {
|
||||||
|
|
@ -188,6 +188,7 @@ public class ForgeServerSwitchHandler {
|
||||||
}
|
}
|
||||||
connection.flush();
|
connection.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void complete() {
|
private void complete() {
|
||||||
VelocityConfiguration configuration = (VelocityConfiguration) ambassador.server.getConfiguration();
|
VelocityConfiguration configuration = (VelocityConfiguration) ambassador.server.getConfiguration();
|
||||||
UUID playerUniqueId = player.getUniqueId();
|
UUID playerUniqueId = player.getUniqueId();
|
||||||
|
|
@ -202,5 +203,15 @@ public class ForgeServerSwitchHandler {
|
||||||
connection.setSessionHandler(originalHandler);
|
connection.setSessionHandler(originalHandler);
|
||||||
continuation.resume();
|
continuation.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleUnknown(ByteBuf buf) {
|
||||||
|
originalHandler.handleUnknown(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disconnected() {
|
||||||
|
originalHandler.disconnected();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user