Fixed Packet issues

This commit is contained in:
StevenRS11 2013-11-11 17:24:20 -05:00
parent 0f49c8c28f
commit 5cd5a323e0
3 changed files with 41 additions and 26 deletions

View file

@ -19,25 +19,6 @@ public class ConnectionHandler implements IConnectionHandler
@Override
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
{
return null;
}
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) { }
@Override
public void connectionOpened(NetHandler netClientHandler,MinecraftServer server, INetworkManager manager) { }
@Override
public void connectionClosed(INetworkManager manager) { }
@Override
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) { }
@Override
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
{
//Send information about all the registered dimensions and links to the client
try
{
Packet250CustomPayload packet = new Packet250CustomPayload();
@ -56,5 +37,31 @@ public class ConnectionHandler implements IConnectionHandler
//This shouldn't happen...
e.printStackTrace();
}
return null;
}
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) { }
@Override
public void connectionOpened(NetHandler netClientHandler,MinecraftServer server, INetworkManager manager) { }
@Override
public void connectionClosed(INetworkManager manager)
{
if(PocketManager.isConnected)
{
PocketManager.unload();
}
}
@Override
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) { }
@Override
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
{
//Send information about all the registered dimensions and links to the client
}
}

View file

@ -204,6 +204,10 @@ public class PocketManager
private static volatile boolean isLoading = false;
private static volatile boolean isLoaded = false;
private static volatile boolean isSaving = false;
/**
* Set as true if we are a client that has connected to a dedicated server
*/
public static volatile boolean isConnected = false;
private static final UpdateWatcherProxy<Point4D> linkWatcher = new UpdateWatcherProxy<Point4D>();
private static final UpdateWatcherProxy<ClientDimData> dimWatcher = new UpdateWatcherProxy<ClientDimData>();
private static ArrayList<NewDimData> rootDimensions = null;
@ -564,6 +568,10 @@ public class PocketManager
//Any pocket dimension must be listed with PocketManager to have a dimension ID
//assigned, so it's safe to assume that any unknown dimensions don't belong to us.
if(PocketManager.dimensionData == null)
{
System.out.println("Something odd happend during shutdown");
}
NewDimData dimension = PocketManager.dimensionData.get(dimensionID);
if (dimension == null)
{
@ -585,16 +593,19 @@ public class PocketManager
public static void unload()
{
System.out.println("Dimensional Doors unloading...");
if (!isLoaded)
{
throw new IllegalStateException("Pocket dimensions have already been unloaded!");
}
save();
unregisterPockets();
dimensionData = null;
rootDimensions = null;
isLoaded = false;
isConnected = false;
}
public static DimLink getLink(int x, int y, int z, World world)
@ -680,12 +691,9 @@ public class PocketManager
throw new IllegalStateException("Pocket dimensions are already loading!");
}
// Load compacted client-side dimension data
load();
Compactor.readDimensions(input, new DimRegistrationCallback());
// Register pocket dimensions
DDProperties properties = DDProperties.instance();
registerPockets(properties);
isConnected = true;
isLoaded = true;
isLoading = false;
}

View file

@ -94,7 +94,7 @@ serverPacketHandlerSpec =
public class mod_pocketDim
{
public static final String version = "1.5.2R1.4.1RC1";
public static final String version = "1.5.2R2.0.1RC1";
public static final String modid = "DimDoors";
//need to clean up