2013-03-24 05:52:50 +01:00
|
|
|
package StevenDimDoors.mod_pocketDim.commands;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Collection;
|
|
|
|
|
2013-06-18 16:23:31 +02:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2013-03-24 05:52:50 +01:00
|
|
|
import StevenDimDoors.mod_pocketDim.DimData;
|
|
|
|
import StevenDimDoors.mod_pocketDim.LinkData;
|
2013-06-10 23:03:52 +02:00
|
|
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
2013-03-24 05:52:50 +01:00
|
|
|
|
2013-06-18 16:23:31 +02:00
|
|
|
public class CommandPrintDimensionData extends DDCommandBase
|
2013-03-24 05:52:50 +01:00
|
|
|
{
|
2013-06-18 16:23:31 +02:00
|
|
|
private static CommandPrintDimensionData instance = null;
|
|
|
|
|
|
|
|
private CommandPrintDimensionData()
|
2013-03-24 05:52:50 +01:00
|
|
|
{
|
2013-06-18 16:23:31 +02:00
|
|
|
super("dd-dimensiondata");
|
2013-03-24 05:52:50 +01:00
|
|
|
}
|
|
|
|
|
2013-06-18 16:23:31 +02:00
|
|
|
public static CommandPrintDimensionData instance()
|
|
|
|
{
|
|
|
|
if (instance == null)
|
|
|
|
instance = new CommandPrintDimensionData();
|
2013-03-24 05:52:50 +01:00
|
|
|
|
2013-06-18 16:23:31 +02:00
|
|
|
return instance;
|
|
|
|
}
|
2013-03-24 05:52:50 +01:00
|
|
|
|
|
|
|
@Override
|
2013-06-18 16:23:31 +02:00
|
|
|
protected void processCommand(EntityPlayer sender, String[] command)
|
2013-03-24 05:52:50 +01:00
|
|
|
{
|
|
|
|
int targetDim;
|
|
|
|
boolean shouldGo= true;
|
2013-06-18 16:23:31 +02:00
|
|
|
|
|
|
|
if(command.length==0)
|
2013-03-24 05:52:50 +01:00
|
|
|
{
|
2013-06-18 16:23:31 +02:00
|
|
|
targetDim= sender.worldObj.provider.dimensionId;
|
2013-03-24 05:52:50 +01:00
|
|
|
}
|
2013-06-18 16:23:31 +02:00
|
|
|
else if(command.length==1)
|
2013-03-24 05:52:50 +01:00
|
|
|
{
|
2013-06-18 16:23:31 +02:00
|
|
|
targetDim = parseInt(sender, command[0]);
|
2013-03-24 05:52:50 +01:00
|
|
|
if(!dimHelper.dimList.containsKey(targetDim))
|
|
|
|
{
|
2013-06-18 16:23:31 +02:00
|
|
|
sender.sendChatToPlayer("Error- dim "+targetDim+" not registered");
|
2013-03-24 05:52:50 +01:00
|
|
|
shouldGo=false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
targetDim=0;
|
|
|
|
shouldGo=false;
|
2013-06-18 16:23:31 +02:00
|
|
|
sender.sendChatToPlayer("Error-Invalid argument, print_dim_data <targetDimID> or blank for current dim");
|
2013-03-24 05:52:50 +01:00
|
|
|
}
|
2013-06-18 16:23:31 +02:00
|
|
|
|
2013-03-24 05:52:50 +01:00
|
|
|
if(shouldGo)
|
|
|
|
{
|
|
|
|
if(dimHelper.dimList.containsKey(targetDim))
|
|
|
|
{
|
2013-06-02 03:43:56 +02:00
|
|
|
DimData dimData = dimHelper.dimList.get(targetDim);
|
2013-06-18 16:23:31 +02:00
|
|
|
Collection<LinkData> links = new ArrayList<LinkData>();
|
|
|
|
links.addAll( dimData.printAllLinkData());
|
2013-06-02 03:43:56 +02:00
|
|
|
|
2013-06-18 16:23:31 +02:00
|
|
|
for (LinkData link : links)
|
|
|
|
{
|
|
|
|
sender.sendChatToPlayer(link.printLinkData());
|
2013-03-24 05:52:50 +01:00
|
|
|
}
|
2013-06-18 16:23:31 +02:00
|
|
|
sender.sendChatToPlayer("DimID= "+dimData.dimID+"Dim depth = "+dimData.depth);
|
|
|
|
}
|
|
|
|
}
|
2013-03-24 05:52:50 +01:00
|
|
|
}
|
2013-06-18 16:23:31 +02:00
|
|
|
}
|