Everything appears to be working, celebrate!

This commit is contained in:
md_5 2012-10-05 15:34:01 +10:00
parent 68e1445b1e
commit 196612b259
2 changed files with 14 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import javax.crypto.SecretKey;
import net.md_5.bungee.packet.Packet1Login;
import net.md_5.bungee.packet.Packet2Handshake;
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.PacketFDEncryptionRequest;
import net.md_5.bungee.packet.PacketFFKick;
@ -58,6 +59,7 @@ public class ServerConnection extends GenericConnection {
throw new KickException("[Kicked] " + new PacketFFKick(loginResponse).message);
}
Packet1Login login = new Packet1Login(loginResponse);
out.write(new PacketFAPluginMessage("REGISTER", "RubberBand".getBytes()).getPacket());
return new ServerConnection(name, socket, in, out, login);
} catch (KickException ex) {

View File

@ -53,6 +53,11 @@ public class UserConnection extends GenericConnection implements CommandSender {
upBridge = new UpstreamBridge();
upBridge.start();
} else {
downBridge.alive = false;
try {
downBridge.join();
} catch (InterruptedException ie) {
}
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());
@ -143,14 +148,16 @@ public class UserConnection extends GenericConnection implements CommandSender {
private class DownstreamBridge extends Thread {
private volatile boolean alive = true;
public DownstreamBridge() {
super("Downstream Bridge - " + username);
}
@Override
public void run() {
while (!server.socket.isClosed()) {
try {
while (alive) {
byte[] packet = server.in.readPacket();
boolean sendPacket = true;
@ -175,11 +182,11 @@ public class UserConnection extends GenericConnection implements CommandSender {
if (sendPacket) {
out.write(packet);
}
}
} catch (IOException ex) {
} catch (Exception ex) {
destory(Util.exception(ex));
}
}
}
}
}