Everything appears to be working, celebrate!
This commit is contained in:
parent
68e1445b1e
commit
196612b259
@ -8,6 +8,7 @@ import javax.crypto.SecretKey;
|
|||||||
import net.md_5.bungee.packet.Packet1Login;
|
import net.md_5.bungee.packet.Packet1Login;
|
||||||
import net.md_5.bungee.packet.Packet2Handshake;
|
import net.md_5.bungee.packet.Packet2Handshake;
|
||||||
import net.md_5.bungee.packet.PacketCDClientStatus;
|
import net.md_5.bungee.packet.PacketCDClientStatus;
|
||||||
|
import net.md_5.bungee.packet.PacketFAPluginMessage;
|
||||||
import net.md_5.bungee.packet.PacketFCEncryptionResponse;
|
import net.md_5.bungee.packet.PacketFCEncryptionResponse;
|
||||||
import net.md_5.bungee.packet.PacketFDEncryptionRequest;
|
import net.md_5.bungee.packet.PacketFDEncryptionRequest;
|
||||||
import net.md_5.bungee.packet.PacketFFKick;
|
import net.md_5.bungee.packet.PacketFFKick;
|
||||||
@ -58,6 +59,7 @@ public class ServerConnection extends GenericConnection {
|
|||||||
throw new KickException("[Kicked] " + new PacketFFKick(loginResponse).message);
|
throw new KickException("[Kicked] " + new PacketFFKick(loginResponse).message);
|
||||||
}
|
}
|
||||||
Packet1Login login = new Packet1Login(loginResponse);
|
Packet1Login login = new Packet1Login(loginResponse);
|
||||||
|
out.write(new PacketFAPluginMessage("REGISTER", "RubberBand".getBytes()).getPacket());
|
||||||
|
|
||||||
return new ServerConnection(name, socket, in, out, login);
|
return new ServerConnection(name, socket, in, out, login);
|
||||||
} catch (KickException ex) {
|
} catch (KickException ex) {
|
||||||
|
@ -53,6 +53,11 @@ public class UserConnection extends GenericConnection implements CommandSender {
|
|||||||
upBridge = new UpstreamBridge();
|
upBridge = new UpstreamBridge();
|
||||||
upBridge.start();
|
upBridge.start();
|
||||||
} else {
|
} else {
|
||||||
|
downBridge.alive = false;
|
||||||
|
try {
|
||||||
|
downBridge.join();
|
||||||
|
} catch (InterruptedException ie) {
|
||||||
|
}
|
||||||
server.disconnect("Quitting");
|
server.disconnect("Quitting");
|
||||||
out.write(new Packet9Respawn((byte) 1, (byte) 0, (byte) 0, (short) 256, "DEFAULT").getPacket());
|
out.write(new Packet9Respawn((byte) 1, (byte) 0, (byte) 0, (short) 256, "DEFAULT").getPacket());
|
||||||
out.write(new Packet9Respawn((byte) -1, (byte) 0, (byte) 0, (short) 256, "DEFAULT").getPacket());
|
out.write(new Packet9Respawn((byte) -1, (byte) 0, (byte) 0, (short) 256, "DEFAULT").getPacket());
|
||||||
@ -143,14 +148,16 @@ public class UserConnection extends GenericConnection implements CommandSender {
|
|||||||
|
|
||||||
private class DownstreamBridge extends Thread {
|
private class DownstreamBridge extends Thread {
|
||||||
|
|
||||||
|
private volatile boolean alive = true;
|
||||||
|
|
||||||
public DownstreamBridge() {
|
public DownstreamBridge() {
|
||||||
super("Downstream Bridge - " + username);
|
super("Downstream Bridge - " + username);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (!server.socket.isClosed()) {
|
try {
|
||||||
try {
|
while (alive) {
|
||||||
byte[] packet = server.in.readPacket();
|
byte[] packet = server.in.readPacket();
|
||||||
boolean sendPacket = true;
|
boolean sendPacket = true;
|
||||||
|
|
||||||
@ -175,10 +182,10 @@ public class UserConnection extends GenericConnection implements CommandSender {
|
|||||||
if (sendPacket) {
|
if (sendPacket) {
|
||||||
out.write(packet);
|
out.write(packet);
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
|
||||||
} catch (Exception ex) {
|
|
||||||
destory(Util.exception(ex));
|
|
||||||
}
|
}
|
||||||
|
} catch (IOException ex) {
|
||||||
|
} catch (Exception ex) {
|
||||||
|
destory(Util.exception(ex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user