From f7aaed79a6081d88cb07210cb72fe699d155bf3a Mon Sep 17 00:00:00 2001 From: piexel Date: Fri, 6 Nov 2026 14:29:05 +0100 Subject: [PATCH] Move module commands under /iris module Module commands get their own branch, with the alias /iris m. is the root a module registers through ToolingRegistry.registerCommand, so /iris module structure list|info|verify replaces /iris structure list. - Bukkit: the branch word is taken before the Director runs; the Director first, then dispatcher fallback and the merged completions are gone. The first word completes "module". - Modded: the greedy-string tails at the /iris root and inside the structure literal are gone. The module and m literals take one greedy string, because the roots belong to the modules of the pack the sender resolves to when the line runs, so they cannot be Brigadier nodes when the tree is built. - /iris module alone lists the mounted roots and their commands; an unknown root is an error that points to that list. - Permissions are unchanged: iris.all, and commands opened to everyone. - /iris structure import and capture stay Director commands. --- .../iris/core/commands/CommandStructure.java | 2 +- .../arcane/iris/core/service/CommandSVC.java | 40 +++++++--- .../modded/command/ModdedCommandTree.java | 4 +- ...olingTail.java => ModdedModuleBranch.java} | 41 +++++------ .../command/ModdedStructureCommands.java | 3 +- .../command/IrisModdedCommandParityTest.java | 33 ++++++++- .../IrisModdedStructureCommandTest.java | 3 - .../core/datapack/DatapackIngestService.java | 2 +- .../iris/core/modules/StructureCommands.java | 2 +- .../core/modules/StructureModelModule.java | 2 +- .../core/modules/StructureVerification.java | 2 +- .../iris/core/tooling/ToolingCommands.java | 71 +++++++++++++----- core/src/main/resources/languages/de_DE.json | 2 +- core/src/main/resources/languages/es_ES.json | 2 +- core/src/main/resources/languages/fi_FI.json | 2 +- core/src/main/resources/languages/fr_FR.json | 2 +- core/src/main/resources/languages/he_IL.json | 2 +- core/src/main/resources/languages/it_IT.json | 2 +- core/src/main/resources/languages/ja-JP.json | 2 +- core/src/main/resources/languages/ko_KR.json | 2 +- core/src/main/resources/languages/lt_LT.json | 2 +- core/src/main/resources/languages/nl_NL.json | 2 +- core/src/main/resources/languages/pl_PL.json | 2 +- core/src/main/resources/languages/pt_PT.json | 2 +- core/src/main/resources/languages/ru_RU.json | 2 +- core/src/main/resources/languages/tr_TR.json | 2 +- core/src/main/resources/languages/vi_VI.json | 2 +- core/src/main/resources/languages/zh_CN.json | 2 +- core/src/main/resources/languages/zh_TW.json | 2 +- core/src/main/resources/messages/en_US.json | 2 +- .../tooling/CommandRootCollisionTest.java | 2 +- .../core/tooling/StructureCommandsTest.java | 16 ++-- .../core/tooling/ToolingCommandsTest.java | 73 +++++++++++++++---- 33 files changed, 230 insertions(+), 102 deletions(-) rename adapters/modded-common/src/main/java/art/arcane/iris/modded/command/{ModdedToolingTail.java => ModdedModuleBranch.java} (55%) diff --git a/adapters/bukkit/plugin/src/main/java/art/arcane/iris/core/commands/CommandStructure.java b/adapters/bukkit/plugin/src/main/java/art/arcane/iris/core/commands/CommandStructure.java index d14268993..5fca87e87 100644 --- a/adapters/bukkit/plugin/src/main/java/art/arcane/iris/core/commands/CommandStructure.java +++ b/adapters/bukkit/plugin/src/main/java/art/arcane/iris/core/commands/CommandStructure.java @@ -52,7 +52,7 @@ public class CommandStructure implements DirectorExecutor { int imported = jigsaws.imported() + templates.imported() + groups.imported() + captured.imported(); int failed = jigsaws.failed() + templates.failed() + groups.failed() + captured.failed(); sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STRUCTURE_IMPORT_COMPLETE_STRUCTURES_OBJECTS_WRITTEN_FAILED, MessageArgument.untrusted("imported", imported), MessageArgument.untrusted("failed", failed))); - sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STRUCTURE_REFERENCE_THEM_FROM_BIOME_REGION_DIMENSION_STRUCTURES_LIST_RUN_IRIS, MessageArgument.untrusted("value", dimension.getLoadKey()))); + sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STRUCTURE_REFERENCE_THEM_FROM_BIOME_REGION_DIMENSION_STRUCTURES_LIST_RUN_IRIS)); } @Director(name = "capture", description = "Capture live registered structures into editable Iris objects by generating each one in a throwaway scratch world and reading back its blocks. This standalone command overwrites its owned outputs; structures wider/taller than the capture cap and anything that will not generate in a flat overworld are skipped. Each captured structure becomes a single-piece Iris structure you can place from a biome/region/dimension 'structures' list. /iris structure import runs a restricted final capture pass only for non-jigsaw structures that have no loadable NBT template.", descriptionKey = "iris.director.commandstructure.director.capture_code_generated_structures_that_have_no_nbt_template_swamp_huts_igloos", aliases = {"cap"}, origin = DirectorOrigin.BOTH) diff --git a/adapters/bukkit/plugin/src/main/java/art/arcane/iris/core/service/CommandSVC.java b/adapters/bukkit/plugin/src/main/java/art/arcane/iris/core/service/CommandSVC.java index 4f4be7c49..05c9fa0e0 100644 --- a/adapters/bukkit/plugin/src/main/java/art/arcane/iris/core/service/CommandSVC.java +++ b/adapters/bukkit/plugin/src/main/java/art/arcane/iris/core/service/CommandSVC.java @@ -59,6 +59,7 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Optional; @@ -183,7 +184,7 @@ public class CommandSVC implements IrisService, CommandExecutor, TabCompleter, D } private void denyUnlessOpenToEveryone(CommandSender sender, ToolingSender toolingSender, String[] args) { - if (tooling.executeIfOpenToEveryone(toolingSender, Arrays.asList(args))) { + if (isModuleBranch(args) && tooling.executeIfOpenToEveryone(toolingSender, wordsAfterBranch(args))) { return; } ComponentMessenger.sendSection(sender, IrisLanguage.text( @@ -192,19 +193,33 @@ public class CommandSVC implements IrisService, CommandExecutor, TabCompleter, D )); } + private static boolean isModuleBranch(String[] args) { + return args.length > 0 && ToolingCommands.isBranchWord(args[0]); + } + + private static List wordsAfterBranch(String[] args) { + return Arrays.asList(args).subList(1, args.length); + } + public List tabCompleteRoot(CommandSender sender, String alias, String[] args) { - List suggestions = new ArrayList<>(runDirectorTab(sender, alias, args)); - for (String toolingSuggestion : tooling.complete(new BukkitToolingSender(sender), Arrays.asList(args))) { - if (!suggestions.contains(toolingSuggestion)) { - suggestions.add(toolingSuggestion); - } - } + List suggestions = isModuleBranch(args) && args.length > 1 + ? tooling.complete(new BukkitToolingSender(sender), wordsAfterBranch(args)) + : directorSuggestionsWithModuleBranch(sender, alias, args); if (sender instanceof Player player && IrisSettings.get().getGeneral().isCommandSounds()) { player.playSound(player.getLocation(), Sound.BLOCK_AMETHYST_BLOCK_CHIME, 0.25f, RNG.r.f(0.125f, 1.95f)); } return suggestions; } + private List directorSuggestionsWithModuleBranch(CommandSender sender, String alias, String[] args) { + List suggestions = new ArrayList<>(runDirectorTab(sender, alias, args)); + boolean typingFirstWord = args.length == 1; + if (typingFirstWord && ToolingCommands.BRANCH.startsWith(args[0].toLowerCase(Locale.ROOT))) { + suggestions.add(ToolingCommands.BRANCH); + } + return suggestions; + } + private PluginCommand findBukkitCommand() { try { return Iris.instance.getCommand(ROOT_COMMAND); @@ -233,6 +248,12 @@ public class CommandSVC implements IrisService, CommandExecutor, TabCompleter, D } private void executeCommand(CommandSender sender, ToolingSender toolingSender, String label, String[] args) { + if (isModuleBranch(args)) { + tooling.execute(toolingSender, wordsAfterBranch(args)); + playSuccessSound(sender); + return; + } + if (sendHelpIfRequested(sender, args)) { playSuccessSound(sender); return; @@ -245,11 +266,6 @@ public class CommandSVC implements IrisService, CommandExecutor, TabCompleter, D return; } - if (!result.isHandled() && tooling.execute(toolingSender, Arrays.asList(args))) { - playSuccessSound(sender); - return; - } - playFailureSound(sender); if (result.getMessage() == null || result.getMessage().trim().isEmpty()) { new VolmitSender(sender).sendMessage(C.RED + IrisLanguage.text(IrisMessages.COMMAND_UNKNOWN)); diff --git a/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedCommandTree.java b/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedCommandTree.java index 5c23ac1df..6e1c3f5e5 100644 --- a/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedCommandTree.java +++ b/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedCommandTree.java @@ -18,6 +18,7 @@ package art.arcane.iris.modded.command; +import art.arcane.iris.core.tooling.ToolingCommands; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.LongArgumentType; import com.mojang.brigadier.arguments.StringArgumentType; @@ -151,7 +152,8 @@ final class ModdedCommandTree { root.then(ModdedStructureCommands.tree("str")); root.then(ModdedDeveloperCommands.tree("developer")); root.then(ModdedDeveloperCommands.tree("dev")); - root.then(ModdedToolingTail.after()); + root.then(ModdedModuleBranch.tree(ToolingCommands.BRANCH)); + root.then(ModdedModuleBranch.tree(ToolingCommands.BRANCH_ALIAS)); return root; } diff --git a/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedToolingTail.java b/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedModuleBranch.java similarity index 55% rename from adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedToolingTail.java rename to adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedModuleBranch.java index 4c7f7c5b8..ecfddd7bf 100644 --- a/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedToolingTail.java +++ b/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedModuleBranch.java @@ -20,52 +20,51 @@ package art.arcane.iris.modded.command; import art.arcane.iris.core.tooling.ToolingCommands; import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.builder.RequiredArgumentBuilder; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.CompletableFuture; /** - * The tail of a command node that hands the rest of the line to the commands modules register - * ({@link ToolingCommands}). It is a greedy string next to the node's literals, and Brigadier takes a literal that matches - * before any argument, so a literal command always wins over a module's. + * {@code /iris module }: the one branch that hands its words to the commands modules register + * ({@link ToolingCommands}). The roots belong to the modules of whichever pack the sender resolves to when the line runs, + * so the branch cannot describe them as Brigadier nodes when the tree is built; it takes the rest of the line as one + * greedy string. The dispatcher decides who may run what, so the literal has no permission of its own. */ -final class ModdedToolingTail { - private static final String ARGUMENT_NAME = "tooling"; +final class ModdedModuleBranch { + private static final String ARGUMENT_NAME = "command"; private static final int COMMAND_ACCEPTED = 1; private static final ToolingCommands TOOLING = ToolingCommands.forBoundPlatform(); - private ModdedToolingTail() { + private ModdedModuleBranch() { } - /** A tail for the node reached after {@code leadingWords}, which the dispatcher puts before the words the sender types. */ - static RequiredArgumentBuilder after(String... leadingWords) { - List leading = List.of(leadingWords); - return Commands.argument(ARGUMENT_NAME, StringArgumentType.greedyString()) - .suggests((CommandContext context, SuggestionsBuilder builder) -> suggest(context.getSource(), leading, builder)) - .executes((CommandContext context) -> run( - context.getSource(), leading, StringArgumentType.getString(context, ARGUMENT_NAME))); + static LiteralArgumentBuilder tree(String literal) { + return Commands.literal(literal) + .executes((CommandContext context) -> run(context.getSource(), "")) + .then(Commands.argument(ARGUMENT_NAME, StringArgumentType.greedyString()) + .suggests((CommandContext context, SuggestionsBuilder builder) -> + suggest(context.getSource(), builder)) + .executes((CommandContext context) -> + run(context.getSource(), StringArgumentType.getString(context, ARGUMENT_NAME)))); } - private static int run(CommandSourceStack source, List leading, String typed) { - List words = new ArrayList<>(leading); - words.addAll(Arrays.stream(typed.trim().split("\\s+")).filter(word -> !word.isEmpty()).toList()); + private static int run(CommandSourceStack source, String typed) { + List words = Arrays.stream(typed.trim().split("\\s+")).filter(word -> !word.isEmpty()).toList(); TOOLING.executeOffThread(new ModdedToolingSender(source), words); return COMMAND_ACCEPTED; } - private static CompletableFuture suggest(CommandSourceStack source, List leading, SuggestionsBuilder builder) { + private static CompletableFuture suggest(CommandSourceStack source, SuggestionsBuilder builder) { ModdedCommandFeedback.tab(source); String typed = builder.getRemaining(); - List words = new ArrayList<>(leading); - words.addAll(Arrays.asList(typed.split(" ", -1))); + List words = Arrays.asList(typed.split(" ", -1)); SuggestionsBuilder lastWord = builder.createOffset(builder.getStart() + typed.lastIndexOf(' ') + 1); TOOLING.complete(new ModdedToolingSender(source), words).forEach(lastWord::suggest); return lastWord.buildFuture(); diff --git a/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedStructureCommands.java b/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedStructureCommands.java index e5a25fb26..d7f5a52d0 100644 --- a/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedStructureCommands.java +++ b/adapters/modded-common/src/main/java/art/arcane/iris/modded/command/ModdedStructureCommands.java @@ -26,7 +26,7 @@ import net.minecraft.commands.Commands; /** * The {@code /iris structure} literals that only explain the Bukkit-only import and capture. The structure module's own - * commands ({@code list}, {@code info}, {@code verify}) reach the sender through the tooling tail of this node. + * commands ({@code list}, {@code info}, {@code verify}) are under {@code /iris module structure}. */ public final class ModdedStructureCommands { private static final String IMPORT_EXPLANATION = "Structure import rebuilds vanilla & datapack structures as editable Iris resources through Bukkit/NMS template managers; run /iris structure import on a Bukkit server against this pack, then copy the pack folder over."; @@ -47,7 +47,6 @@ public final class ModdedStructureCommands { root.then(message("all", IMPORT_EXPLANATION)); root.then(message("capture", CAPTURE_EXPLANATION)); root.then(message("cap", CAPTURE_EXPLANATION)); - root.then(ModdedToolingTail.after(name)); return root; } diff --git a/adapters/modded-common/src/test/java/art/arcane/iris/modded/command/IrisModdedCommandParityTest.java b/adapters/modded-common/src/test/java/art/arcane/iris/modded/command/IrisModdedCommandParityTest.java index 192baddc8..8c3aa1c09 100644 --- a/adapters/modded-common/src/test/java/art/arcane/iris/modded/command/IrisModdedCommandParityTest.java +++ b/adapters/modded-common/src/test/java/art/arcane/iris/modded/command/IrisModdedCommandParityTest.java @@ -5,7 +5,10 @@ import art.arcane.iris.core.localization.PackDownloadMessages; import art.arcane.iris.core.lifecycle.LifecycleOperationCoordinator; import art.arcane.iris.core.pack.PackDownloader; import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.tree.ArgumentCommandNode; import com.mojang.brigadier.tree.CommandNode; +import com.mojang.brigadier.tree.LiteralCommandNode; import net.minecraft.SharedConstants; import net.minecraft.commands.CommandSourceStack; import net.minecraft.server.Bootstrap; @@ -159,11 +162,39 @@ public class IrisModdedCommandParityTest { assertNotNull("iris", iris.getCommand()); for (String category : new String[]{"help", "find", "goto", "pregen", "pregenerate", "object", "o", "edit", "studio", "std", "s", "pack", "pk", "world", "w", "datapack", "datapacks", "dp", - "structure", "struct", "str", "developer", "dev"}) { + "structure", "struct", "str", "developer", "dev", "module", "m"}) { assertNotNull(category, child(iris, category).getCommand()); } } + @Test + public void moduleCommandsHaveTheirOwnBranchAndNoTailElsewhere() { + CommandNode iris = irisNode(); + + for (CommandNode node : iris.getChildren()) { + assertTrue(node.getName() + " must be a literal", node instanceof LiteralCommandNode); + } + for (CommandNode node : child(iris, "structure").getChildren()) { + assertTrue("structure " + node.getName() + " must be a literal", node instanceof LiteralCommandNode); + } + for (String branch : new String[]{"module", "m"}) { + CommandNode module = child(iris, branch); + assertNotNull(branch + " lists the mounted commands on its own", module.getCommand()); + CommandNode rest = child(module, "command"); + assertTrue(rest instanceof ArgumentCommandNode); + assertEquals(StringArgumentType.StringType.GREEDY_PHRASE, ((StringArgumentType) ((ArgumentCommandNode) rest).getType()).getType()); + assertNotNull(rest.getCommand()); + } + } + + private static CommandNode irisNode() { + SharedConstants.tryDetectVersion(); + Bootstrap.bootStrap(); + CommandDispatcher dispatcher = new CommandDispatcher<>(); + IrisModdedCommands.register(dispatcher); + return child(dispatcher.getRoot(), "iris"); + } + @Test public void consoleHelpListsEveryEntryWithInlineUsageAndDescription() { List root = ModdedCommandHelp.consoleLines(""); diff --git a/adapters/modded-common/src/test/java/art/arcane/iris/modded/command/IrisModdedStructureCommandTest.java b/adapters/modded-common/src/test/java/art/arcane/iris/modded/command/IrisModdedStructureCommandTest.java index 9aa3f054e..5db627235 100644 --- a/adapters/modded-common/src/test/java/art/arcane/iris/modded/command/IrisModdedStructureCommandTest.java +++ b/adapters/modded-common/src/test/java/art/arcane/iris/modded/command/IrisModdedStructureCommandTest.java @@ -282,12 +282,9 @@ public class IrisModdedStructureCommandTest { @Test public void structureListInfoAndVerifyBelongToTheStructureModule() throws IOException { String source = source("ModdedStructureCommands.java"); - String tree = source("ModdedCommandTree.java"); - assertTrue(source.contains("ModdedToolingTail.after(name)")); assertFalse(source.contains("Commands.literal(\"list\")")); assertFalse(source.contains("verifyTree(")); - assertTrue(tree.contains("root.then(ModdedToolingTail.after())")); } private String source(String fileName) throws IOException { diff --git a/core/src/main/java/art/arcane/iris/core/datapack/DatapackIngestService.java b/core/src/main/java/art/arcane/iris/core/datapack/DatapackIngestService.java index 15b3762c3..bb5ce44f8 100644 --- a/core/src/main/java/art/arcane/iris/core/datapack/DatapackIngestService.java +++ b/core/src/main/java/art/arcane/iris/core/datapack/DatapackIngestService.java @@ -680,7 +680,7 @@ public final class DatapackIngestService { message(sender, C.GRAY + "After the restart they generate natively only in Iris dimensions that declare their source URL - no import needed. To get editable Iris copies (jigsaw pools, pieces & objects written into the pack) run /iris structure import , or set general.autoImportDatapackStructures=true to do it on every ingest. Place any registered key directly with a 'structures' placement using nativeStructures."); message(sender, C.GRAY + "Datapacks replace matching vanilla structure keys by default. Set 'importedStructures.datapackOverrides' to false to keep minecraft-namespaced structure definitions untouched; deny non-minecraft datapack and mod structure families with importedStructures.disabled or complete keys with importedStructures.disabledExact."); if (!restart) { - message(sender, C.GRAY + "Run with restart=true to restart now, or restart manually. After restart, run /iris structure list to see the new keys."); + message(sender, C.GRAY + "Run with restart=true to restart now, or restart manually. After restart, run /iris module structure list to see the new keys."); } } diff --git a/core/src/main/java/art/arcane/iris/core/modules/StructureCommands.java b/core/src/main/java/art/arcane/iris/core/modules/StructureCommands.java index d1ae69a6c..9bc980943 100644 --- a/core/src/main/java/art/arcane/iris/core/modules/StructureCommands.java +++ b/core/src/main/java/art/arcane/iris/core/modules/StructureCommands.java @@ -35,7 +35,7 @@ import java.io.File; import java.io.IOException; import java.util.List; -/** The {@code /iris structure} commands of {@link StructureModelModule}: the index, one structure's graph, and the verification of a world's structures. */ +/** The {@code /iris module structure} commands of {@link StructureModelModule}: the index, one structure's graph, and the verification of a world's structures. */ final class StructureCommands { private static final String ROOT_NAME = "structure"; private static final long INFO_SAMPLE_SEED = 1234L; diff --git a/core/src/main/java/art/arcane/iris/core/modules/StructureModelModule.java b/core/src/main/java/art/arcane/iris/core/modules/StructureModelModule.java index 48d556773..2ea29608b 100644 --- a/core/src/main/java/art/arcane/iris/core/modules/StructureModelModule.java +++ b/core/src/main/java/art/arcane/iris/core/modules/StructureModelModule.java @@ -41,7 +41,7 @@ import com.volmit.service.VanillaStructures; * them up, and the pack's structure placements replace them, place them alongside, start them where their * {@code nativeStructures} grids say and fit them into the terrain. *

- * It mounts {@code /iris structure list|info|verify} ({@link StructureCommands}) through the tooling api. + * It mounts {@code /iris module structure list|info|verify} ({@link StructureCommands}) through the tooling api. */ public final class StructureModelModule implements IrisModule { private static final String VERSION = "built-in"; diff --git a/core/src/main/java/art/arcane/iris/core/modules/StructureVerification.java b/core/src/main/java/art/arcane/iris/core/modules/StructureVerification.java index 3872fcc02..2dfc61935 100644 --- a/core/src/main/java/art/arcane/iris/core/modules/StructureVerification.java +++ b/core/src/main/java/art/arcane/iris/core/modules/StructureVerification.java @@ -34,7 +34,7 @@ import java.util.Set; import java.util.TreeSet; /** - * {@code /iris structure verify}: for every structure the platform registers and every structure the pack's modules place, + * {@code /iris module structure verify}: for every structure the platform registers and every structure the pack's modules place, * whether it can generate in the world the sender stands in, searching around the world origin for those the pack places. * Native eligibility is decided without the platform's blocking locate. */ diff --git a/core/src/main/java/art/arcane/iris/core/tooling/ToolingCommands.java b/core/src/main/java/art/arcane/iris/core/tooling/ToolingCommands.java index b76eeb69f..a200cb784 100644 --- a/core/src/main/java/art/arcane/iris/core/tooling/ToolingCommands.java +++ b/core/src/main/java/art/arcane/iris/core/tooling/ToolingCommands.java @@ -37,7 +37,8 @@ import java.util.function.Supplier; /** * The one dispatcher of the commands modules register ({@link com.volmit.tooling.ToolingRegistry#registerCommand}), - * which both adapters mount as the tail of their {@code /iris} root. It resolves the pack first, because the commands + * which both adapters mount as the {@code /iris module } branch (alias {@code m}); it takes the words + * after the branch word. It resolves the pack first, because the commands * belong to one pack's module set: {@code pack=} anywhere in the line, else the pack of the sender's world, else the * pack of the sender's open studio. Then it walks the module's command tree, parses the arguments and runs the action on a * worker thread, so no command runs on the server's main thread or a region thread. @@ -46,6 +47,8 @@ import java.util.function.Supplier; * remaining words joined by single spaces. */ public final class ToolingCommands { + public static final String BRANCH = "module"; + public static final String BRANCH_ALIAS = "m"; private static final String NAME_A_PACK = "Name a pack: " + CommandLine.PACK_OPTION + ""; private static final String WORKER_NAME_PREFIX = "Iris-Tooling-"; @@ -70,15 +73,18 @@ public final class ToolingCommands { return new ToolingCommands(PackDirectory.ofBoundPlatform(), workers, IrisValidationContext::boundPlatformRegistries); } + /** Whether {@code word} opens the module branch of the {@code /iris} root, {@code module} or its alias {@code m}. */ + public static boolean isBranchWord(String word) { + return BRANCH.equalsIgnoreCase(word) || BRANCH_ALIAS.equalsIgnoreCase(word); + } + /** - * Runs the command the words name, if some module of the resolved pack registers its root: the pack, the tree and the - * arguments are resolved on the calling thread and the action runs on a worker. A problem with the line reaches the - * sender as an error. - * - * @return whether the line was a command of this dispatcher; false leaves the sender without a reply + * Runs the command the words after the branch word name: the pack, the tree and the arguments are resolved on the + * calling thread and the action runs on a worker. No command word lists the commands of the pack's modules, and a + * problem with the line reaches the sender as an error. */ - public boolean execute(ToolingSender sender, List words) { - return run(sender, words, false); + public void execute(ToolingSender sender, List words) { + run(sender, words, false); } /** @@ -93,11 +99,7 @@ public final class ToolingCommands { /** Like {@link #execute}, with the resolving done on a worker too, for callers that must not block. */ public void executeOffThread(ToolingSender sender, List words) { - workers.execute(() -> { - if (!execute(sender, words)) { - sender.error("Unknown command"); - } - }); + workers.execute(() -> execute(sender, words)); } /** The words that can follow {@code words}, whose last word is the one being typed. */ @@ -133,14 +135,22 @@ public final class ToolingCommands { private boolean run(ToolingSender sender, List tokens, boolean onlyIfOpenToEveryone) { try { CommandLine line = CommandLine.of(tokens); - if (line.words().isEmpty()) { + ResolvedPack pack = resolvePack(sender, line.packName()); + List roots = rootsOf(pack.served()); + if (line.words().isEmpty() && onlyIfOpenToEveryone) { return false; } - ResolvedPack pack = resolvePack(sender, line.packName()); - Optional located = LocatedCommand.locate(rootsOf(pack.served()), line.words()); - if (located.isEmpty()) { + if (line.words().isEmpty()) { + describeMountedRoots(sender, pack.served(), roots); + return true; + } + Optional located = LocatedCommand.locate(roots, line.words()); + if (located.isEmpty() && onlyIfOpenToEveryone) { return false; } + if (located.isEmpty()) { + throw new CommandFailure("No module command named " + line.words().getFirst(), "List them with /iris module"); + } if (onlyIfOpenToEveryone && !located.get().command().isOpenToEveryone()) { return false; } @@ -277,6 +287,33 @@ public final class ToolingCommands { } } + private static void describeMountedRoots(ToolingSender sender, ServedPack pack, List roots) { + List lines = new ArrayList<>(); + for (CommandRegistration root : roots) { + collectUsageLines(sender, List.of(root.command().name()), root.command(), lines); + } + if (lines.isEmpty()) { + sender.info("No module of pack " + pack.name() + " has commands for you"); + return; + } + sender.info("Module commands of pack " + pack.name() + ", run as /iris module :"); + lines.forEach(line -> sender.info(" " + line)); + } + + private static void collectUsageLines(ToolingSender sender, List path, Command command, List lines) { + if (!mayRun(sender, command)) { + return; + } + if (command.action().isPresent()) { + lines.add(LocatedCommand.usageOf(path, command) + (command.description().isEmpty() ? "" : " - " + command.description())); + } + for (Command child : command.children()) { + List childPath = new ArrayList<>(path); + childPath.add(child.name()); + collectUsageLines(sender, childPath, child, lines); + } + } + private static void describeGroup(ToolingSender sender, LocatedCommand located) { if (!located.arguments().isEmpty()) { sender.error("Unknown " + located.pathText() + " sub-command: " + located.arguments().getFirst()); diff --git a/core/src/main/resources/languages/de_DE.json b/core/src/main/resources/languages/de_DE.json index 6415aeac6..32200b827 100644 --- a/core/src/main/resources/languages/de_DE.json +++ b/core/src/main/resources/languages/de_DE.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cDer Pack für Dimension {value} konnte nicht aufgelöst werden", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aAlle Vanilla- und Datapack-Strukturen werden in §f{value}§a importiert (überschreiben)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aImport abgeschlossen: §f{imported}§a structures/objects geschrieben, §f{failed}§a fehlgeschlagen.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Referenziere sie in der 'structures'-Liste eines Bioms, einer Region oder Dimension, oder führe /iris structure list {value} aus, um den Index zu aktualisieren. Regeneriere Chunks, damit die Änderungen wirksam werden.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Referenziere sie in der 'structures'-Liste eines Bioms, einer Region oder Dimension, oder führe /iris module structure list aus, um den Index zu aktualisieren. Regeneriere Chunks, damit die Änderungen wirksam werden.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cDer Pack für Dimension {value} konnte nicht aufgelöst werden", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7{value} Strukturen erfasst. Platziere sie über eine 'structures'-Liste und regeneriere Chunks. Lösche eine Datei unter structures/*.json, um sie erneut zu erfassen.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aStudio für den Pack \"{value}\" wird geöffnet (Seed: {seed})", diff --git a/core/src/main/resources/languages/es_ES.json b/core/src/main/resources/languages/es_ES.json index a90f8164e..b0b538522 100644 --- a/core/src/main/resources/languages/es_ES.json +++ b/core/src/main/resources/languages/es_ES.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cNo se pudo resolver el pack de la dimensión {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aImportando todas las estructuras vanilla y de datapacks en §f{value}§a (sobrescritura)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aImportación completada: §f{imported}§a structures/objects escritos, §f{failed}§a fallidos.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Haz referencia a ellas desde una lista 'structures' de un bioma, región o dimensión, o ejecuta /iris structure list {value} para actualizar el índice. Regenera los chunks para aplicar los cambios.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Haz referencia a ellas desde una lista 'structures' de un bioma, región o dimensión, o ejecuta /iris module structure list para actualizar el índice. Regenera los chunks para aplicar los cambios.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cNo se pudo resolver el pack de la dimensión {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7Se capturaron {value} estructuras. Colócalas desde una lista 'structures' y regenera los chunks. Elimina un archivo structures/*.json para volver a capturarlo.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aAbriendo Studio para el pack \"{value}\" (semilla: {seed})", diff --git a/core/src/main/resources/languages/fi_FI.json b/core/src/main/resources/languages/fi_FI.json index 8fa77db27..d7b6c95df 100644 --- a/core/src/main/resources/languages/fi_FI.json +++ b/core/src/main/resources/languages/fi_FI.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cPakkausta ei voitu ratkaista mitan vuoksi {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aVanillan tuonti & datapakettiin §f{value}§a (korvaa)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aTuo valmis: §f{imported}§a structures/objects kirjallinen §f{failed}§a Epäonnistui.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Viedään ne biome/alue/ulottuvuus-rakenneluettelosta tai ajetaan /iris structure list {value} Päivittääksesi indeksin. Luo palasia muutoksia voimaan.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Viedään ne biome/alue/ulottuvuus-rakenneluettelosta tai ajetaan /iris module structure list Päivittääksesi indeksin. Luo palasia muutoksia voimaan.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cPakkausta ei voitu ratkaista mitan vuoksi {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7Vangittu {value} rakenteet. Aseta ne \"rakennelistasta\" ja uudista palasia. Poista a structures/*.json Saada se takaisin.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aAvaa studio \"{value}\" pakkaus (siemen: {seed})", diff --git a/core/src/main/resources/languages/fr_FR.json b/core/src/main/resources/languages/fr_FR.json index 7c6a31df6..1741f386e 100644 --- a/core/src/main/resources/languages/fr_FR.json +++ b/core/src/main/resources/languages/fr_FR.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cImpossible de résoudre le pack de la dimension {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aImportation de toutes les structures vanilla et de datapacks dans §f{value}§a (écrasement)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aImportation terminée : §f{imported}§a structures/objects écrits, §f{failed}§a échecs.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Référencez-les depuis une liste 'structures' de biome, région ou dimension, ou exécutez /iris structure list {value} pour actualiser l'index. Régénérez les chunks pour appliquer les changements.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Référencez-les depuis une liste 'structures' de biome, région ou dimension, ou exécutez /iris module structure list pour actualiser l'index. Régénérez les chunks pour appliquer les changements.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cImpossible de résoudre le pack de la dimension {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7{value} structures ont été capturées. Placez-les depuis une liste 'structures' et régénérez les chunks. Supprimez un fichier structures/*.json pour le capturer à nouveau.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aOuverture de Studio pour le pack \"{value}\" (graine : {seed})", diff --git a/core/src/main/resources/languages/he_IL.json b/core/src/main/resources/languages/he_IL.json index 3909faa82..cf88455d3 100644 --- a/core/src/main/resources/languages/he_IL.json +++ b/core/src/main/resources/languages/he_IL.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cלא יכול לפתור את החבילה לממד {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aייבוא כל vanilla & מבנים לתוך §f{value}§a (המשך)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aיבוא שלם: §f{imported}§a structures/objects כתוב, §f{failed}§a נכשל.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7הפניה אותם מרשימת ביום/אזור / מידע, או ריצה /iris structure list {value} כדי לרענן את המדד. לנתח חלקים לשינויים כדי להשפיע.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7הפניה אותם מרשימת ביום/אזור / מידע, או ריצה /iris module structure list כדי לרענן את המדד. לנתח חלקים לשינויים כדי להשפיע.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cלא יכול לפתור את החבילה לממד {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7נתפס {value} מבנים. מניחים אותם מתוך רשימת \"בני מבנים\" ו- צור מחדש. למחוק structures/*.json להחזיר אותו מחדש.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aסטודיו פתיחה ל\"{value}\"חבילה\" (צילום: {seed})", diff --git a/core/src/main/resources/languages/it_IT.json b/core/src/main/resources/languages/it_IT.json index ea4dbb5e2..160a41cae 100644 --- a/core/src/main/resources/languages/it_IT.json +++ b/core/src/main/resources/languages/it_IT.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cImpossibile risolvere il pack della dimensione {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aImportazione di tutte le strutture vanilla e datapack in §f{value}§a (sovrascrittura)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aImportazione completata: §f{imported}§a structures/objects scritti, §f{failed}§a non riusciti.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Aggiungile all'elenco 'structures' di un bioma, una regione o una dimensione, oppure esegui /iris structure list {value} per aggiornare l'indice. Rigenera i chunk per applicare le modifiche.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Aggiungile all'elenco 'structures' di un bioma, una regione o una dimensione, oppure esegui /iris module structure list per aggiornare l'indice. Rigenera i chunk per applicare le modifiche.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cImpossibile risolvere il pack della dimensione {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7Acquisite {value} strutture. Posizionale tramite un elenco 'structures' e rigenera i chunk. Elimina un file in structures/*.json per acquisirlo nuovamente.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aApertura di Studio per il pack \"{value}\" (seed: {seed})", diff --git a/core/src/main/resources/languages/ja-JP.json b/core/src/main/resources/languages/ja-JP.json index 7a9ee4626..fb819a731 100644 --- a/core/src/main/resources/languages/ja-JP.json +++ b/core/src/main/resources/languages/ja-JP.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cディメンション {value} のパックを解決できませんでした", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aすべてのバニラおよびデータパック構造物を §f{value}§a にインポートしています(上書き)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aインポート完了: §f{imported}§a 件を structures/objects に書き込み、§f{failed}§a 件が失敗しました。", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7biome/region/dimension の 'structures' リストから参照するか、/iris structure list {value} を実行してインデックスを更新してください。変更を反映するにはチャンクを再生成してください。", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7biome/region/dimension の 'structures' リストから参照するか、/iris module structure list を実行してインデックスを更新してください。変更を反映するにはチャンクを再生成してください。", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cディメンション {value} のパックを解決できませんでした", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7{value} 件の構造物をキャプチャしました。'structures' リストから配置してチャンクを再生成してください。再キャプチャするには structures/*.json を削除してください。", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aパック \"{value}\" のスタジオを開いています(シード: {seed})", diff --git a/core/src/main/resources/languages/ko_KR.json b/core/src/main/resources/languages/ko_KR.json index 6ae0ffaae..877f32628 100644 --- a/core/src/main/resources/languages/ko_KR.json +++ b/core/src/main/resources/languages/ko_KR.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§c차원을 위한 팩을 해결할 수 없습니다 {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§a가져오는 중 모든 바닐라 & 데이터 팩 구조 §f{value}§a (overwrite) ...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§a가져오기 완료: structures/objects §f{imported}§a개 기록, §f{failed}§a개 실패.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7biome/region/dimension의 'structures' 목록에서 참조하거나 /iris structure list {value} 명령을 실행하여 인덱스를 새로 고치세요. 변경 사항을 적용하려면 청크를 다시 생성하세요.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7biome/region/dimension의 'structures' 목록에서 참조하거나 /iris module structure list 명령을 실행하여 인덱스를 새로 고치세요. 변경 사항을 적용하려면 청크를 다시 생성하세요.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§c차원을 위한 팩을 해결할 수 없습니다 {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7다운로드 {value} 구조. 'structures' 목록에서 배치하고 청크를 재생합니다. 더 알아보기 structures/*.json 다시 캡처합니다.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§a\"를 위한 오프닝 스튜디오{value}\"팩 (seed: {seed})", diff --git a/core/src/main/resources/languages/lt_LT.json b/core/src/main/resources/languages/lt_LT.json index 19611e8c9..4bc657a4c 100644 --- a/core/src/main/resources/languages/lt_LT.json +++ b/core/src/main/resources/languages/lt_LT.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cNepavyko išspręsti pakuotės dimensijai {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aImportuojama visa vanilla & duomenų kaupimo struktūros į §f{value}§a (perrašyti)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aImportuoti pilną: §f{imported}§a structures/objects raštu, §f{failed}§a Nepavyko.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Nuoroda į juos iš biomo / regiono / dimensijos \"struktūrų\" sąrašo arba paleisti /iris structure list {value} atnaujinti indeksą. Regeneruoti gabaliukus, kad pakeitimai įsigaliotų.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Nuoroda į juos iš biomo / regiono / dimensijos \"struktūrų\" sąrašo arba paleisti /iris module structure list atnaujinti indeksą. Regeneruoti gabaliukus, kad pakeitimai įsigaliotų.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cNepavyko išspręsti pakuotės dimensijai {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7Kapinti {value} struktūros. Įdėkite juos iš \"struktūrų\" sąrašo ir regeneruoti gabaliukus. Pašalinti structures/*.json kad jį vėl pagautų.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aAtidarymo studija \"{value}\"pakuotė (sėkla: {seed})", diff --git a/core/src/main/resources/languages/nl_NL.json b/core/src/main/resources/languages/nl_NL.json index b9fbd4ab1..b96ebdec0 100644 --- a/core/src/main/resources/languages/nl_NL.json +++ b/core/src/main/resources/languages/nl_NL.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cKon het pakket voor dimensie niet oplossen {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aAlle vanilla importeren & datapack structuren in §f{value}§a (overschrijven)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aImporteren voltooid: §f{imported}§a structures/objects schriftelijk, §f{failed}§a mislukt.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Refereer ze vanuit een lijst met biome/regio's/dimensiestructuren, of voer ze uit /iris structure list {value} om de index te vernieuwen. Regenereer chunks voor veranderingen die van kracht worden.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Refereer ze vanuit een lijst met biome/regio's/dimensiestructuren, of voer ze uit /iris module structure list om de index te vernieuwen. Regenereer chunks voor veranderingen die van kracht worden.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cKon het pakket voor dimensie niet oplossen {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7Gevangen {value} structuren. Plaats ze van een 'structuren' lijst en regenereer chunks. Verwijderen structures/*.json om het te heroveren.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aopenen studio voor de \"{value}\" verpakking (zaad: {seed})", diff --git a/core/src/main/resources/languages/pl_PL.json b/core/src/main/resources/languages/pl_PL.json index 7272d64d7..8cbd24be5 100644 --- a/core/src/main/resources/languages/pl_PL.json +++ b/core/src/main/resources/languages/pl_PL.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cNie można rozwiązać pakietu dla wymiaru {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aImportowanie całej vanilla & struktury datapack do §f{value}§a (nadpisać)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aImport zakończony: §f{imported}§a structures/objects na piśmie, §f{failed}§a Nie udało się.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Odniesienie do nich z listy \"struktur\" / regionu / wymiaru, lub uruchomić /iris structure list {value} aby odświeżyć indeks. Regeneruj chunki, aby zmiany zaczęły obowiązywać.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Odniesienie do nich z listy \"struktur\" / regionu / wymiaru, lub uruchomić /iris module structure list aby odświeżyć indeks. Regeneruj chunki, aby zmiany zaczęły obowiązywać.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cNie można rozwiązać pakietu dla wymiaru {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7Uchwycony {value} struktury. Umieścić je z listy \"struktur\" i regenerować chunki. Usuń structures/*.json by go ponownie uchwycić.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aStudio otwarcia dla \"{value}\"opakowanie (nasiona: {seed})", diff --git a/core/src/main/resources/languages/pt_PT.json b/core/src/main/resources/languages/pt_PT.json index 6de5d8c1f..62df15a6d 100644 --- a/core/src/main/resources/languages/pt_PT.json +++ b/core/src/main/resources/languages/pt_PT.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cNão foi possível resolver o pacote para a dimensão {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aImportando toda a vanilla & estruturas do pacote de dados para §f{value}§a (sobrescrever)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aImportação concluída: §f{imported}§a structures/objects escrita, §f{failed}§a falhou.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Referência de uma lista «estruturas» de bioma/região/dimensão ou execução /iris structure list {value} para atualizar o índice. Regenerar chunks para que as alterações façam efeito.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Referência de uma lista «estruturas» de bioma/região/dimensão ou execução /iris module structure list para atualizar o índice. Regenerar chunks para que as alterações façam efeito.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cNão foi possível resolver o pacote para a dimensão {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7Capturado {value} estruturas. Coloque-os a partir de uma lista de estruturas e regenerar chunks. Apagar a structures/*.json Para o recapturar.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aEstúdio de abertura para o \"{value}\" pack (sementes: {seed})", diff --git a/core/src/main/resources/languages/ru_RU.json b/core/src/main/resources/languages/ru_RU.json index d7418af36..ecc38eb93 100644 --- a/core/src/main/resources/languages/ru_RU.json +++ b/core/src/main/resources/languages/ru_RU.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cНе удалось решить пакет для измерения {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aИмпорт vanilla & структуры пакета данных в §f{value}§a (перезапись)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aИмпорт полный: §f{imported}§a structures/objects письменно, §f{failed}§a провалился.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Ссылка на них из списка «структур» биома / региона / измерения или запуска /iris structure list {value} Обновить индекс. Регенерировать чанки, чтобы изменения вступили в силу.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Ссылка на них из списка «структур» биома / региона / измерения или запуска /iris module structure list Обновить индекс. Регенерировать чанки, чтобы изменения вступили в силу.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cНе удалось решить пакет для измерения {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7захваченный {value} структур. Поместите их из списка «структур» и восстановите чанки. Исключить a structures/*.json Чтобы вернуть его.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aОткрытие студии для\"{value}\"пак (семя):{seed})", diff --git a/core/src/main/resources/languages/tr_TR.json b/core/src/main/resources/languages/tr_TR.json index 8b59628f9..6e9341add 100644 --- a/core/src/main/resources/languages/tr_TR.json +++ b/core/src/main/resources/languages/tr_TR.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cpaketi boyut için çözemez {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aTüm vanillayı ithal etmek & Datapack yapıları içine §f{value}§a (over write)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aTamam: §f{imported}§a structures/objects yazılı, §f{failed}§a başarısız oldu.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Onları bir biyome/bölge/dimension 'yapılar' listesinden referans edin veya çalıştırın /iris structure list {value} indeksi yenilemek için. Etkisi almak için değişiklikler için regenerate chunks.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Onları bir biyome/bölge/dimension 'yapılar' listesinden referans edin veya çalıştırın /iris module structure list indeksi yenilemek için. Etkisi almak için değişiklikler için regenerate chunks.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cpaketi boyut için çözemez {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7Yakalandı {value} yapılar. Onları bir 'yapılar' listesinden yerleştirin ve yenidengenerate chunks. silme structures/*.json Yeniden inşa etmek için.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aAçılış stüdyosu \"{value}\" paket (seed: {seed})", diff --git a/core/src/main/resources/languages/vi_VI.json b/core/src/main/resources/languages/vi_VI.json index 4d7afb590..70416ada4 100644 --- a/core/src/main/resources/languages/vi_VI.json +++ b/core/src/main/resources/languages/vi_VI.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cKhông thể giải quyết gói cho kích thước {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aName & Comment §f{value}§a ( dư viết)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aNhập xong: §f{imported}§a structures/objects Đã viết, §f{failed}§a bị lỗi.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Tham khảo chúng từ danh sách cấu trúc của sinh học/region/dimensision, hoặc chạy /iris structure list {value} để làm lại chỉ mục. Tạo lại các mảng để thay đổi có tác dụng.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Tham khảo chúng từ danh sách cấu trúc của sinh học/region/dimensision, hoặc chạy /iris module structure list để làm lại chỉ mục. Tạo lại các mảng để thay đổi có tác dụng.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cKhông thể giải quyết gói cho kích thước {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7Đã bắt {value} cấu trúc. Đặt chúng từ một danh sách cấu trúc và tái tạo các mảng. Xoá structures/*.json Để bắt lại nó.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aMở studio cho \"{value}\" Gói (dòng dõi: {seed})", diff --git a/core/src/main/resources/languages/zh_CN.json b/core/src/main/resources/languages/zh_CN.json index 4b395b29e..716946607 100644 --- a/core/src/main/resources/languages/zh_CN.json +++ b/core/src/main/resources/languages/zh_CN.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§c无法解析大小包 {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§a导入全部原版 & 数据包结构进入 §f{value}§a (覆盖)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§a导入完成 : §f{imported}§a structures/objects 写, §f{failed}§a 失败 。", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7参考生物群落/ 区域/ 构造列表, 或运行 /iris structure list {value} 用于刷新索引。 重新生成块以生效 。", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7参考生物群落/ 区域/ 构造列表, 或运行 /iris module structure list 用于刷新索引。 重新生成块以生效 。", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§c无法解析大小包 {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7已捕获 {value} 结构。 把它们从“ 结构” 列表中放置, 再生块 。 删除 a structures/*.json 重新抓起来", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§a工作室 \"{value}\" 包(种子: {seed})", diff --git a/core/src/main/resources/languages/zh_TW.json b/core/src/main/resources/languages/zh_TW.json index a31626134..a922d7ce4 100644 --- a/core/src/main/resources/languages/zh_TW.json +++ b/core/src/main/resources/languages/zh_TW.json @@ -236,7 +236,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§c無法解析大小包 {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§a匯入全部原版 & 資料包結構進入 §f{value}§a (覆蓋)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§a匯入完成 : §f{imported}§a structures/objects 寫, §f{failed}§a 失敗 。", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7參考生物群落/ 區域/ 構造列表, 或執行 /iris structure list {value} 用於重新整理索引。 重新生成塊以生效 。", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7參考生物群落/ 區域/ 構造列表, 或執行 /iris module structure list 用於重新整理索引。 重新生成塊以生效 。", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§c無法解析大小包 {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7已捕獲 {value} 結構。 把它們從“ 結構” 列表中放置, 再生塊 。 刪除 a structures/*.json 重新抓起來", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§a工作室 \"{value}\" 包(種子: {seed})", diff --git a/core/src/main/resources/messages/en_US.json b/core/src/main/resources/messages/en_US.json index ba19ffab5..2d929b370 100644 --- a/core/src/main/resources/messages/en_US.json +++ b/core/src/main/resources/messages/en_US.json @@ -212,7 +212,7 @@ "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_2": "§cCould not resolve the pack for dimension {value}", "iris.bukkit.commandstructure.importing_all_vanilla_datapack_structures_into_overwrite": "§aImporting all vanilla & datapack structures into §f{value}§a (overwrite)...", "iris.bukkit.commandstructure.import_complete_structures_objects_written_failed": "§aImport complete: §f{imported}§a structures/objects written, §f{failed}§a failed.", - "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Reference them from a biome/region/dimension 'structures' list, or run /iris structure list {value} to refresh the index. Regenerate chunks for changes to take effect.", + "iris.bukkit.commandstructure.reference_them_from_biome_region_dimension_structures_list_run_iris": "§7Reference them from a biome/region/dimension 'structures' list, or run /iris module structure list to refresh the index. Regenerate chunks for changes to take effect.", "iris.bukkit.commandstructure.could_not_resolve_pack_dimension_3": "§cCould not resolve the pack for dimension {value}", "iris.bukkit.commandstructure.captured_structures_place_them_from_structures_list_regenerate_chunks_delete": "§7Captured {value} structures. Place them from a 'structures' list and regenerate chunks. Delete a structures/*.json to re-capture it.", "iris.bukkit.commandstudio.opening_studio_pack_seed": "§aOpening studio for the \"{value}\" pack (seed: {seed})", diff --git a/core/src/test/java/art/arcane/iris/core/tooling/CommandRootCollisionTest.java b/core/src/test/java/art/arcane/iris/core/tooling/CommandRootCollisionTest.java index e1089101e..d27c6b563 100644 --- a/core/src/test/java/art/arcane/iris/core/tooling/CommandRootCollisionTest.java +++ b/core/src/test/java/art/arcane/iris/core/tooling/CommandRootCollisionTest.java @@ -75,7 +75,7 @@ public class CommandRootCollisionTest { } }, Runnable::run, Optional::empty); - assertTrue(dispatcher.execute(sender, List.of("structure", "list"))); + dispatcher.execute(sender, List.of("structure", "list")); assertEquals(1, sender.errors.size()); assertTrue(sender.errors.get(0), sender.errors.get(0).startsWith("The modules of pack clashing did not load: Command root structure")); diff --git a/core/src/test/java/art/arcane/iris/core/tooling/StructureCommandsTest.java b/core/src/test/java/art/arcane/iris/core/tooling/StructureCommandsTest.java index 9c8d81437..83fb1658d 100644 --- a/core/src/test/java/art/arcane/iris/core/tooling/StructureCommandsTest.java +++ b/core/src/test/java/art/arcane/iris/core/tooling/StructureCommandsTest.java @@ -81,13 +81,13 @@ public class StructureCommandsTest { } } - private boolean run(String line) { - return dispatcher.execute(sender, List.of(line.split(" "))); + private void run(String line) { + dispatcher.execute(sender, List.of(line.split(" "))); } @Test public void listWritesTheStructureIndexThroughAnEditAndReloadsOnce() throws Exception { - assertTrue(run("structure list pack=overworld")); + run("structure list pack=overworld"); File index = new File(packFolder, ".iris/structure-index.json"); assertTrue(index.isFile()); @@ -99,14 +99,14 @@ public class StructureCommandsTest { @Test public void theAliasesOfTheRootAndTheCommandAnswerToo() { - assertTrue(run("str ls pack=overworld")); + run("str ls pack=overworld"); assertEquals(1, sender.successes.size()); } @Test public void infoNamesTheStructureByTheResourcesOfThePack() { - assertTrue(run("structure info nowhere pack=overworld")); + run("structure info nowhere pack=overworld"); assertEquals(List.of("No structures resource 'nowhere' in this pack"), sender.errors); assertEquals(List.of("Use: structure info "), sender.infos); @@ -114,7 +114,7 @@ public class StructureCommandsTest { @Test public void infoAssemblesTheStructureAndReportsAnInvalidGraphAsTheCommandsFailure() { - assertTrue(run("structure info empty-castle pack=overworld")); + run("structure info empty-castle pack=overworld"); assertEquals(1, sender.errors.size()); assertTrue(sender.errors.get(0), sender.errors.get(0).startsWith("structure info failed: ")); @@ -123,14 +123,14 @@ public class StructureCommandsTest { @Test public void verifyNeedsTheWorldOfTheSender() { - assertTrue(run("structure verify pack=overworld")); + run("structure verify pack=overworld"); assertEquals(List.of("Stand in a world generated with this pack: verify reads the running world"), sender.errors); } @Test public void theGroupListsTheThreeCommands() { - assertTrue(run("structure pack=overworld")); + run("structure pack=overworld"); assertEquals(4, sender.infos.size()); assertTrue(sender.infos.get(1).startsWith(" structure list")); diff --git a/core/src/test/java/art/arcane/iris/core/tooling/ToolingCommandsTest.java b/core/src/test/java/art/arcane/iris/core/tooling/ToolingCommandsTest.java index ac9cd20b6..a1fcdbeee 100644 --- a/core/src/test/java/art/arcane/iris/core/tooling/ToolingCommandsTest.java +++ b/core/src/test/java/art/arcane/iris/core/tooling/ToolingCommandsTest.java @@ -94,8 +94,8 @@ public class ToolingCommandsTest { return line.isBlank() ? List.of() : List.of(line.trim().split("\\s+", -1)); } - private boolean run(String line) { - return dispatcher.execute(sender, words(line)); + private void run(String line) { + dispatcher.execute(sender, words(line)); } private List complete(String line) { @@ -119,8 +119,8 @@ public class ToolingCommandsTest { .runs(context -> seen.add(List.of(context.get(label), context.get(count), context.get(mode))))); standIn(packsByName.get("one")); - assertTrue(run("give apple 3")); - assertTrue(run("give pear 7 fast-pass")); + run("give apple 3"); + run("give pear 7 fast-pass"); assertEquals(List.of(List.of("apple", 3L, Mode.SLOW), List.of("pear", 7L, Mode.FAST_PASS)), seen); assertTrue(sender.errors.isEmpty()); @@ -132,7 +132,7 @@ public class ToolingCommandsTest { .argument(Argument.word("note").orElse("none")).runs(context -> seen.add("ran"))); standIn(packsByName.get("one")); - assertTrue(run("give apple")); + run("give apple"); assertEquals(List.of("Missing count"), sender.errors); assertEquals(List.of("Use: give