mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-08-27 12:41:43 +00:00
f
This commit is contained in:
@@ -60,6 +60,7 @@ import java.nio.file.Files;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -134,6 +135,12 @@ public class CommandIris implements DirectorExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
Optional<String> startupDenial = ServerConfigurator.worldCreationDenialReason(false);
|
||||
if (startupDenial.isPresent()) {
|
||||
sender().sendMessage(C.YELLOW + startupDenial.get());
|
||||
return;
|
||||
}
|
||||
|
||||
String resolvedType = type.equalsIgnoreCase("default")
|
||||
? IrisSettings.get().getGenerator().getDefaultWorldType()
|
||||
: type;
|
||||
|
||||
+4
-2
@@ -120,9 +120,11 @@ public class CommandStudio implements DirectorExecutor {
|
||||
@Param(description = "The dimension pack to open a studio for", descriptionKey = "iris.director.commandstudio.param.dimension_pack_open_studio", aliases = "dim", customHandler = DimensionHandler.class)
|
||||
IrisDimension dimension,
|
||||
@Param(defaultValue = "1337", description = "The seed to generate the studio with", descriptionKey = "iris.director.commandstudio.param.seed_generate_studio_with", aliases = "s")
|
||||
long seed) {
|
||||
long seed,
|
||||
@Param(defaultValue = "false", description = "Attempt to open Studio before a required registry restart", aliases = "f")
|
||||
boolean force) {
|
||||
sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STUDIO_OPENING_STUDIO_PACK_SEED, MessageArgument.untrusted("value", dimension.getName()), MessageArgument.untrusted("seed", seed)));
|
||||
Iris.service(StudioSVC.class).open(sender(), seed, dimension.getLoadKey());
|
||||
Iris.service(StudioSVC.class).open(sender(), seed, dimension.getLoadKey(), force);
|
||||
}
|
||||
|
||||
@Director(description = "Import vanilla trees, mushrooms & objects (and structures/jigsaw) from the server into a pack's objects/vanilla folder", descriptionKey = "iris.director.commandstudio.director.import_vanilla_trees_mushrooms_objects_structures_jigsaw_from_server_into_pack_s", aliases = {"importv", "iv"}, origin = DirectorOrigin.BOTH)
|
||||
|
||||
+16
@@ -8,9 +8,11 @@ import org.junit.Test;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Parameter;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class CommandStudioCreationContractTest {
|
||||
@Test
|
||||
@@ -24,4 +26,18 @@ public class CommandStudioCreationContractTest {
|
||||
assertEquals("null", template.defaultValue());
|
||||
assertEquals(NullableDimensionHandler.class, template.customHandler());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void openExposesAnOptInForceFlag() throws NoSuchMethodException {
|
||||
Method command = CommandStudio.class.getDeclaredMethod(
|
||||
"open",
|
||||
IrisDimension.class,
|
||||
long.class,
|
||||
boolean.class
|
||||
);
|
||||
Param force = command.getParameters()[2].getAnnotation(Param.class);
|
||||
|
||||
assertEquals("false", force.defaultValue());
|
||||
assertTrue(List.of(force.aliases()).contains("f"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user