Working on dungeon deletion
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
package StevenDimDoors.mod_pocketDim.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
|
||||
@@ -10,7 +15,7 @@ public class CommandResetDungeons extends DDCommandBase
|
||||
|
||||
private CommandResetDungeons()
|
||||
{
|
||||
super("dd-rebuilddungeons", "");
|
||||
super("dd-resetdungeons", "");
|
||||
}
|
||||
|
||||
public static CommandResetDungeons instance()
|
||||
@@ -31,21 +36,39 @@ public class CommandResetDungeons extends DDCommandBase
|
||||
|
||||
int dungeonCount = 0;
|
||||
int resetCount = 0;
|
||||
ArrayList<Integer> dimIdsToDelete= new ArrayList<Integer>();
|
||||
|
||||
for (NewDimData data : PocketManager.getDimensions())
|
||||
{
|
||||
if (data.isDungeon())
|
||||
dungeonCount++;
|
||||
if(DimensionManager.getWorld(data.id())==null)
|
||||
{
|
||||
dungeonCount++;
|
||||
if (PocketManager.resetDungeon(data))
|
||||
if (data.isDungeon())
|
||||
{
|
||||
resetCount++;
|
||||
PocketManager.deleteDimensionFolder(data);
|
||||
dimIdsToDelete.add(data.id());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(DimLink link : data.links())
|
||||
{
|
||||
if(link.linkType()==LinkTypes.REVERSE)
|
||||
{
|
||||
data.createLink(link.source(), LinkTypes.DUNGEON_EXIT, link.orientation());
|
||||
}
|
||||
if(link.linkType()==LinkTypes.DUNGEON)
|
||||
{
|
||||
data.createLink(link.source(), LinkTypes.DUNGEON, link.orientation());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resetCount = PocketManager.deleteDimensionData(dimIdsToDelete);
|
||||
//TODO implement blackList
|
||||
|
||||
//Notify the user of the results
|
||||
sender.sendChatToPlayer("Reset complete. " + resetCount + " out of " + dungeonCount + " dungeons were rebuilt.");
|
||||
sender.sendChatToPlayer("Reset complete. " + resetCount + " out of " + dungeonCount + " dungeons were reset.");
|
||||
return DDCommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user