Fix hard link to DedicatedSerever when opening a LAN connection causing stalls on connecting.
This commit is contained in:
parent
d3d244f4a2
commit
9b615893d9
5 changed files with 26 additions and 8 deletions
|
@ -1,18 +1,17 @@
|
|||
--- ../src-base/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java
|
||||
+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java
|
||||
@@ -7,6 +7,7 @@
|
||||
import net.minecraft.network.handshake.client.C00Handshake;
|
||||
import net.minecraft.network.login.server.S00PacketDisconnect;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.server.network;
|
||||
|
||||
+import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import io.netty.util.concurrent.GenericFutureListener;
|
||||
import net.minecraft.network.EnumConnectionState;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
@@ -24,6 +25,14 @@
|
||||
|
||||
public void func_147383_a(C00Handshake p_147383_1_)
|
||||
{
|
||||
+ if (!DedicatedServer.allowPlayerLogins)
|
||||
+ if (!FMLCommonHandler.instance().shouldAllowPlayerLogins())
|
||||
+ {
|
||||
+ ChatComponentText chatcomponenttext = new ChatComponentText("Server is still starting! Please wait before reconnecting.");
|
||||
+ this.field_147386_b.func_150725_a(new S00PacketDisconnect(chatcomponenttext), new GenericFutureListener[0]);
|
||||
|
|
|
@ -876,4 +876,10 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
{
|
||||
return report.func_71505_b() instanceof GameRegistryException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAllowPlayerLogins()
|
||||
{
|
||||
return true; //Always true as the server has to be started before clicking 'Open to lan'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -518,4 +518,9 @@ public class FMLCommonHandler
|
|||
{
|
||||
return sidedDelegate.getDefaultMissingAction();
|
||||
}
|
||||
|
||||
public boolean shouldAllowPlayerLogins()
|
||||
{
|
||||
return sidedDelegate.shouldAllowPlayerLogins();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,4 +61,6 @@ public interface IFMLSidedHandler
|
|||
void serverLoadedSuccessfully();
|
||||
|
||||
void failedServerLoading(RuntimeException ex, WorldAccessContainer wac);
|
||||
|
||||
boolean shouldAllowPlayerLogins();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.network.INetHandler;
|
|||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.IFMLSidedHandler;
|
||||
|
@ -196,4 +197,9 @@ public class FMLServerHandler implements IFMLSidedHandler
|
|||
{
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean shouldAllowPlayerLogins()
|
||||
{
|
||||
return DedicatedServer.allowPlayerLogins;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue