fixed kick on relay failure, fixed player not logging out serverside
This commit is contained in:
parent
87ee7918ba
commit
e4afd4dc90
Binary file not shown.
36056
javascript/classes.js
36056
javascript/classes.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -255,6 +255,7 @@ addServer.SSLWarn2=html5 will only allow wss://
|
|||
directConnect.prompt=What would you like to do?
|
||||
directConnect.lanWorld=Join LAN World
|
||||
directConnect.lanWorldCode=Enter Join Code:
|
||||
directConnect.networkSettingsNote=Click 'Network Settings' to add a relay URL
|
||||
directConnect.serverJoin=Connect to Server
|
||||
directConnect.lanWorldJoin=Join World
|
||||
directConnect.lanWorldRelay=Network Settings
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetServerHandler;
|
||||
|
||||
public class WorkerListenThread {
|
||||
/** Reference to the MinecraftServer object. */
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.server.MinecraftServer;
|
|||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetLoginHandler;
|
||||
import net.minecraft.src.NetServerHandler;
|
||||
import net.minecraft.src.Packet;
|
||||
|
||||
public class WorkerNetworkManager implements INetworkManager {
|
||||
|
@ -112,6 +113,9 @@ public class WorkerNetworkManager implements INetworkManager {
|
|||
listenThread.closeChannel(ipcChannel);
|
||||
IntegratedServer.sendIPCPacket(new IPCPacket0CPlayerChannel(ipcChannel, false));
|
||||
}
|
||||
if(theNetHandler != null && (theNetHandler instanceof NetServerHandler)) {
|
||||
((NetServerHandler)theNetHandler).kickPlayer(null);
|
||||
}
|
||||
isAlive = false;
|
||||
}
|
||||
|
||||
|
@ -126,6 +130,9 @@ public class WorkerNetworkManager implements INetworkManager {
|
|||
listenThread.closeChannel(ipcChannel);
|
||||
IntegratedServer.sendIPCPacket(new IPCPacket0CPlayerChannel(ipcChannel, false));
|
||||
}
|
||||
if(theNetHandler != null && (theNetHandler instanceof NetServerHandler)) {
|
||||
((NetServerHandler)theNetHandler).kickPlayer(null);
|
||||
}
|
||||
isAlive = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,13 +108,15 @@ public class NetServerHandler extends NetHandler {
|
|||
*/
|
||||
public void kickPlayer(String par1Str) {
|
||||
if (!this.connectionClosed) {
|
||||
this.connectionClosed = true;
|
||||
this.playerEntity.mountEntityAndWakeUp();
|
||||
this.sendPacket(new Packet255KickDisconnect(par1Str));
|
||||
if(par1Str != null) {
|
||||
this.sendPacket(new Packet255KickDisconnect(par1Str));
|
||||
}
|
||||
this.netManager.serverShutdown();
|
||||
this.mcServer.getConfigurationManager().sendPacketToAllPlayers(
|
||||
new Packet3Chat(EnumChatFormatting.YELLOW + this.playerEntity.username + " left the game."));
|
||||
this.mcServer.getConfigurationManager().playerLoggedOut(this.playerEntity);
|
||||
this.connectionClosed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ public class GuiScreenLANConnect extends GuiScreen {
|
|||
this.drawDefaultBackground();
|
||||
this.drawCenteredString(this.fontRenderer, var4.translateKey("selectServer.direct"), this.width / 2, this.height / 4 - 60 + 20, 16777215);
|
||||
this.drawString(this.fontRenderer, var4.translateKey("directConnect.lanWorldCode"), this.width / 2 - 100, this.height / 4 + 12, 10526880);
|
||||
this.drawCenteredString(this.fontRenderer, var4.translateKey("directConnect.networkSettingsNote"), this.width / 2, this.height / 4 + 67, 10526880);
|
||||
this.codeTextField.drawTextBox();
|
||||
super.drawScreen(xx, yy, pt);
|
||||
this.relaysButton.drawScreen(xx, yy);
|
||||
|
|
|
@ -394,9 +394,7 @@ public class IntegratedServer {
|
|||
}
|
||||
}
|
||||
|
||||
if(IntegratedServerLAN.isHostingLAN()) {
|
||||
IntegratedServerLAN.updateLANServer();
|
||||
}
|
||||
IntegratedServerLAN.updateLANServer();
|
||||
}
|
||||
|
||||
public static void sendIPCPacket(IPCPacketBase pkt) {
|
||||
|
|
|
@ -156,17 +156,14 @@ public class IntegratedServerLAN {
|
|||
}
|
||||
if(lanRelaySocket.isClosed()) {
|
||||
lanRelaySocket = null;
|
||||
currentCode = null;
|
||||
cleanupLAN();
|
||||
}else {
|
||||
Iterator<LANClient> itr = clients.values().iterator();
|
||||
while(itr.hasNext()) {
|
||||
LANClient cl = itr.next();
|
||||
cl.update();
|
||||
if(cl.dead) {
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Iterator<LANClient> itr = clients.values().iterator();
|
||||
while(itr.hasNext()) {
|
||||
LANClient cl = itr.next();
|
||||
cl.update();
|
||||
if(cl.dead) {
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -292,22 +289,22 @@ public class IntegratedServerLAN {
|
|||
|
||||
protected void update() {
|
||||
if(state == CONNECTED) {
|
||||
PKT pk;
|
||||
while(state == CONNECTED && (pk = EaglerAdapter.recieveFromIntegratedServer("NET|" + clientId)) != null) {
|
||||
EaglerAdapter.serverLANWritePacket(clientId, pk.data);
|
||||
}
|
||||
LANPeerEvent evt;
|
||||
while(state == CONNECTED && (evt = EaglerAdapter.serverLANGetEvent(clientId)) != null) {
|
||||
if(evt instanceof LANPeerEvent.LANPeerPacketEvent) {
|
||||
EaglerAdapter.sendToIntegratedServer("NET|" + clientId, ((LANPeerEvent.LANPeerPacketEvent)evt).payload);
|
||||
}else if(evt instanceof LANPeerEvent.LANPeerDisconnectEvent) {
|
||||
System.err.println("LAN client '" + clientId + "' disconnected");
|
||||
System.out.println("LAN client '" + clientId + "' disconnected");
|
||||
disconnect();
|
||||
}else {
|
||||
System.err.println("LAN client '" + clientId + "' had an accident: " + evt.getClass().getSimpleName());
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
PKT pk;
|
||||
while(state == CONNECTED && (pk = EaglerAdapter.recieveFromIntegratedServer("NET|" + clientId)) != null) {
|
||||
EaglerAdapter.serverLANWritePacket(clientId, pk.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,9 +315,6 @@ public class IntegratedServerLAN {
|
|||
EaglerAdapter.disableChannel("NET|" + clientId);
|
||||
}
|
||||
state = CLOSED;
|
||||
if (lanRelaySocket != null) {
|
||||
lanRelaySocket.writePacket(new IPacketFEDisconnectClient(clientId, IPacketFEDisconnectClient.TYPE_SERVER_DISCONNECT, "Connection Closed"));
|
||||
}
|
||||
EaglerAdapter.serverLANDisconnectPeer(clientId);
|
||||
dead = true;
|
||||
}
|
||||
|
|
|
@ -225,12 +225,14 @@ public class LANClientNetworkManager implements INetworkManager {
|
|||
theNetHandler = var1;
|
||||
}
|
||||
|
||||
private ByteArrayOutputStream sendBuffer = new ByteArrayOutputStream();
|
||||
|
||||
@Override
|
||||
public void addToSendQueue(Packet var1) {
|
||||
try {
|
||||
ByteArrayOutputStream bao = new ByteArrayOutputStream(var1.getPacketSize() + 1);
|
||||
Packet.writePacket(var1, new DataOutputStream(bao));
|
||||
EaglerAdapter.clientLANSendPacket(bao.toByteArray());
|
||||
sendBuffer.reset();
|
||||
Packet.writePacket(var1, new DataOutputStream(sendBuffer));
|
||||
EaglerAdapter.clientLANSendPacket(sendBuffer.toByteArray());
|
||||
}catch(IOException e) {
|
||||
System.err.println("Failed to serialize minecraft packet '" + var1.getClass().getSimpleName() + "' to remote LAN world");
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -27,12 +27,14 @@ public class WorkerNetworkManager implements INetworkManager {
|
|||
theNetHandler = var1;
|
||||
}
|
||||
|
||||
private ByteArrayOutputStream sendBuffer = new ByteArrayOutputStream();
|
||||
|
||||
@Override
|
||||
public void addToSendQueue(Packet var1) {
|
||||
try {
|
||||
ByteArrayOutputStream bao = new ByteArrayOutputStream(var1.getPacketSize() + 1);
|
||||
Packet.writePacket(var1, new DataOutputStream(bao));
|
||||
EaglerAdapter.sendToIntegratedServer("NET|" + ipcChannel, bao.toByteArray());
|
||||
sendBuffer.reset();
|
||||
Packet.writePacket(var1, new DataOutputStream(sendBuffer));
|
||||
EaglerAdapter.sendToIntegratedServer("NET|" + ipcChannel, sendBuffer.toByteArray());
|
||||
}catch(IOException e) {
|
||||
System.err.println("Failed to serialize minecraft packet '" + var1.getClass().getSimpleName() + "' for IPC channel 'NET|" + ipcChannel + "'");
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue
Block a user