Improved CommandPruneDimensions
Improved CommandPruneDimensions. Cleaned up the code and improved performance by using a HashSet instead of an ArrayList to list dimension reachability. Added an optional argument that sets whether we should delete the folders of pruned dimensions.
This commit is contained in:
@@ -816,7 +816,7 @@ public class dimHelper extends DimensionManager
|
||||
public boolean resetPocket(DimData dimData)
|
||||
{
|
||||
//TODO: Should we add a check to see if the dimension is currently loaded? How could we check that? ~SenseiKiwi
|
||||
if (getWorld(dimData.dimID) != null || !dimData.isPocket)
|
||||
if (!dimData.isPocket || getWorld(dimData.dimID) != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -836,6 +836,23 @@ public class dimHelper extends DimensionManager
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean pruneDimension(DimData dimData, boolean deleteFolder)
|
||||
{
|
||||
//TODO: Should we add a check to see if the dimension is currently loaded? How could we check that? ~SenseiKiwi
|
||||
//TODO: All the logic for checking that this is an isolated pocket should be moved in here.
|
||||
if (!dimData.isPocket || getWorld(dimData.dimID) != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
dimList.remove(dimData.dimID);
|
||||
if (deleteFolder)
|
||||
{
|
||||
File save = new File(getCurrentSaveRootDirectory() + "/DimensionalDoors/pocketDimID" + dimData.dimID);
|
||||
DeleteFolder.deleteFolder(save);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* method called when the client disconnects/server stops to unregister dims.
|
||||
* @Return
|
||||
|
||||
Reference in New Issue
Block a user