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