Command fixes

This commit is contained in:
Daniel Mills 2020-10-21 10:02:36 -04:00
parent b3e1c48f97
commit 0a0617c5fc
5 changed files with 66 additions and 1 deletions

View File

@ -37,6 +37,7 @@ public class CommandIrisCreate extends MortarCommand
if(args.length == 0)
{
sender.sendMessage("/iris create <NAME> [type=overworld] [seed=1337] [pregen=5000] [-zip]");
return true;
}
String worldName = args[0];

View File

@ -61,6 +61,7 @@ public class CommandIrisRegen extends MortarCommand
{
sender.sendMessage("/iris regen [SIZE]");
}
return true;
}

View File

@ -47,6 +47,9 @@ public class CommandIrisStudio extends MortarCommand
@Command
private CommandIrisStudioLoot loot;
@Command
private CommandIrisStudioTP tp;
public CommandIrisStudio()
{
super("studio", "std");

View File

@ -0,0 +1,52 @@
package com.volmit.iris.command;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
public class CommandIrisStudioTP extends MortarCommand
{
public CommandIrisStudioTP()
{
super("tp");
requiresPermission(Iris.perm.studio);
setDescription("Go to the spawn of the currently open studio world.");
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(!Iris.proj.isProjectOpen())
{
sender.sendMessage("There is not a studio currently loaded.");
return true;
}
try
{
sender.sendMessage("Teleporting you to the active studio world.");
sender.player().teleport(Iris.proj.getActiveProject().getActiveProvider().getTarget().getRealWorld().getSpawnLocation());
}
catch(Throwable e)
{
sender.sendMessage("Failed to teleport to the studio world. Try re-opening the project.");
}
return true;
}
@Override
protected String getArgsUsage()
{
return "";
}
}

View File

@ -31,7 +31,15 @@ public class CommandIrisStudioUpdate extends MortarCommand
return true;
}
new IrisProject(Iris.proj.getWorkspaceFolder(args[0])).updateWorkspace();
if(new IrisProject(Iris.proj.getWorkspaceFolder(args[0])).updateWorkspace())
{
sender.sendMessage("Updated Code Workspace for " + args[0]);
}
else
{
sender.sendMessage("Invalid project: " + args[0] + ". Try deleting the code-workspace file and try again.");
}
return true;
}