DimDoors/StevenDimDoors/mod_pocketDim/ConnectionHandler.java
SenseiKiwi b11354767d Overhauled configuration properties
Moved all configuration variables from mod_pocketDim to DDProperties
(formerly DimDoorsConfig). Changed property names to be clearer in
config file, modified some comments, and generally cleaned up the config
file. Fixed some missing properties and variables that were reading from
the wrong properties. Modified the order in which mod_pocketDim
instantiated some of its static fields so that they would load after
properties are read. Almost all classes load after properties are read.
Fixed indentation across various files and replaced references to
properties in mod_pocketDim with references to DDProperties.
2013-06-13 19:01:54 -04:00

81 lines
No EOL
1.9 KiB
Java

package StevenDimDoors.mod_pocketDim;
import java.util.ArrayList;
import java.util.Collection;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.NetLoginHandler;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet1Login;
import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.network.IConnectionHandler;
import cpw.mods.fml.common.network.Player;
public class ConnectionHandler implements IConnectionHandler
{
private static boolean connected = false;
private static DDProperties properties = null;
//sends a packet to clients containing all the information about the dims and links. Lots of packets, actually.
@Override
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
{
if (properties == null)
properties = DDProperties.instance();
Collection set = new ArrayList();
set.addAll(dimHelper.dimList.keySet());
PacketHandler.onClientJoinPacket(manager, dimHelper.dimList);
PacketHandler.onDimCreatedPacket(new DimData(properties.LimboDimensionID, false, 0, 0, 0, 0, 0));
return null;
}
@Override
public void connectionOpened(NetHandler netClientHandler, String server,int port, INetworkManager manager)
{
connected = true;
}
@Override
public void connectionOpened(NetHandler netClientHandler,MinecraftServer server, INetworkManager manager)
{
}
@Override
public void connectionClosed(INetworkManager manager)
{
if (connected)
{
System.out.println("Clearing dim cache");
dimHelper.instance.save();
dimHelper.instance.unregsisterDims();
dimHelper.dimList.clear();
}
connected = false;
}
@Override
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager,
Packet1Login login)
{
}
@Override
public void playerLoggedIn(Player player, NetHandler netHandler,
INetworkManager manager)
{
}
}