Iris/src/main/java/com/volmit/iris/command/CommandIrisStudioCreate.java
Daniel Mills 0e217e431b Fixes
2020-09-04 23:14:34 -04:00

64 lines
1.2 KiB
Java

package com.volmit.iris.command;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import com.volmit.iris.util.C;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
public class CommandIrisStudioCreate extends MortarCommand
{
public CommandIrisStudioCreate()
{
super("create", "new");
requiresPermission(Iris.perm.studio);
setDescription("Create a new project & open it.");
setCategory("Studio");
}
@Override
public boolean handle(MortarSender sender, String[] args)
{
if(!IrisSettings.get().isStudio())
{
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
return true;
}
if(args.length < 1)
{
sender.sendMessage("Please use a lowercase name with hyphens (-) for spaces.");
sender.sendMessage("I.e. /iris std new " + C.BOLD + "aether");
return true;
}
String template = null;
for(String i : args)
{
if(i.startsWith("template="))
{
template = i.split("\\Q=\\E")[1];
}
}
if(template != null)
{
Iris.proj.create(sender, args[0], template);
}
else
{
Iris.proj.create(sender, args[0]);
}
return true;
}
@Override
protected String getArgsUsage()
{
return "[dimension] [template=<project>]";
}
}