Reviewed and Rewrote Commands #169
@@ -315,44 +315,43 @@ public class PocketManager
|
||||
{
|
||||
if (deleteFolder)
|
||||
{
|
||||
deleteDimensionFiles(target);
|
||||
deleteDimensionFiles(dimension);
|
||||
}
|
||||
dimensionIDBlackList.add(dimension.id);
|
||||
deleteDimensionData(dimension.id);
|
||||
deleteDimensionData(dimension);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean deleteDimensionFiles(NewDimData target)
|
||||
{
|
||||
InnerDimData dimension = (InnerDimData) target;
|
||||
if (dimension.isPocketDimension() && DimensionManager.getWorld(dimension.id()) == null)
|
||||
private static void deleteDimensionFiles(InnerDimData dimension)
|
||||
{
|
||||
// We assume that the caller checks if the dimension is loaded, for the
|
||||
// sake of efficiency. Don't call this on a loaded dimension or bad
|
||||
// things will happen!
|
||||
String saveRootPath = DimensionManager.getCurrentSaveRootDirectory().getAbsolutePath();
|
||||
File saveDirectory = new File(saveRootPath + "/DimensionalDoors/pocketDimID" + dimension.id());
|
||||
DeleteFolder.deleteFolder(saveDirectory);
|
||||
File dataFile = new File(saveRootPath + "/DimensionalDoors/data/dim_" + dimension.id() + ".txt");
|
||||
dataFile.delete();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean deleteDimensionData(int dimensionID)
|
||||
private static void deleteDimensionData(InnerDimData dimension)
|
||||
{
|
||||
if (dimensionData.containsKey(dimensionID) && DimensionManager.getWorld(dimensionID) == null)
|
||||
// We assume that the caller checks if the dimension is loaded, for the
|
||||
// sake of efficiency. Don't call this on a loaded dimension or bad
|
||||
// things will happen!
|
||||
if (dimensionData.remove(dimension.id()) != null)
|
||||
{
|
||||
NewDimData target = PocketManager.getDimensionData(dimensionID);
|
||||
InnerDimData dimension = (InnerDimData) target;
|
||||
|
||||
dimensionData.remove(dimensionID);
|
||||
// Raise the dim deleted event
|
||||
getDimwatcher().onDeleted(new ClientDimData(dimension));
|
||||
dimension.clear();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
else
|
||||
{
|
||||
// This should never happen. A simple sanity check.
|
||||
throw new IllegalArgumentException("The specified dimension is not listed with PocketManager.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerPockets(DDProperties properties)
|
||||
@@ -647,11 +646,8 @@ public class PocketManager
|
||||
{
|
||||
return dimension.getLink(x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isBlackListed(int dimensionID)
|
||||
{
|
||||
@@ -716,9 +712,6 @@ public class PocketManager
|
||||
load();
|
||||
Compactor.readDimensions(input, new DimRegistrationCallback());
|
||||
|
||||
// Register pocket dimensions
|
||||
DDProperties properties = DDProperties.instance();
|
||||
|
||||
isLoaded = true;
|
||||
isLoading = false;
|
||||
isConnected = true;
|
||||
|
||||
Reference in New Issue
Block a user