mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Move module commands under /iris module <root> <command...>
Module commands get their own branch, with the alias /iris m. <root> 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.
This commit is contained in:
1 parent
88fe8c8bcd
commit
f7aaed79a6
33 files changed
+230
-102
No files matched your search
+1
-1
@@ -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)
|
||||
|
||||
@@ -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<String> wordsAfterBranch(String[] args) {
|
||||
return Arrays.asList(args).subList(1, args.length);
|
||||
}
|
||||
|
||||
public List<String> tabCompleteRoot(CommandSender sender, String alias, String[] args) {
|
||||
List<String> 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<String> 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<String> directorSuggestionsWithModuleBranch(CommandSender sender, String alias, String[] args) {
|
||||
List<String> 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));
|
||||
|
||||
+3
-1
@@ -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;
|
||||
}
|
||||
|
||||
+20
-21
@@ -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 <root> <command...>}: 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<CommandSourceStack, String> after(String... leadingWords) {
|
||||
List<String> leading = List.of(leadingWords);
|
||||
return Commands.argument(ARGUMENT_NAME, StringArgumentType.greedyString())
|
||||
.suggests((CommandContext<CommandSourceStack> context, SuggestionsBuilder builder) -> suggest(context.getSource(), leading, builder))
|
||||
.executes((CommandContext<CommandSourceStack> context) -> run(
|
||||
context.getSource(), leading, StringArgumentType.getString(context, ARGUMENT_NAME)));
|
||||
static LiteralArgumentBuilder<CommandSourceStack> tree(String literal) {
|
||||
return Commands.literal(literal)
|
||||
.executes((CommandContext<CommandSourceStack> context) -> run(context.getSource(), ""))
|
||||
.then(Commands.argument(ARGUMENT_NAME, StringArgumentType.greedyString())
|
||||
.suggests((CommandContext<CommandSourceStack> context, SuggestionsBuilder builder) ->
|
||||
suggest(context.getSource(), builder))
|
||||
.executes((CommandContext<CommandSourceStack> context) ->
|
||||
run(context.getSource(), StringArgumentType.getString(context, ARGUMENT_NAME))));
|
||||
}
|
||||
|
||||
private static int run(CommandSourceStack source, List<String> leading, String typed) {
|
||||
List<String> 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<String> words = Arrays.stream(typed.trim().split("\\s+")).filter(word -> !word.isEmpty()).toList();
|
||||
TOOLING.executeOffThread(new ModdedToolingSender(source), words);
|
||||
return COMMAND_ACCEPTED;
|
||||
}
|
||||
|
||||
private static CompletableFuture<Suggestions> suggest(CommandSourceStack source, List<String> leading, SuggestionsBuilder builder) {
|
||||
private static CompletableFuture<Suggestions> suggest(CommandSourceStack source, SuggestionsBuilder builder) {
|
||||
ModdedCommandFeedback.tab(source);
|
||||
String typed = builder.getRemaining();
|
||||
List<String> words = new ArrayList<>(leading);
|
||||
words.addAll(Arrays.asList(typed.split(" ", -1)));
|
||||
List<String> 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();
|
||||
+1
-2
@@ -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;
|
||||
}
|
||||
|
||||
+32
-1
@@ -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<CommandSourceStack> iris = irisNode();
|
||||
|
||||
for (CommandNode<CommandSourceStack> node : iris.getChildren()) {
|
||||
assertTrue(node.getName() + " must be a literal", node instanceof LiteralCommandNode);
|
||||
}
|
||||
for (CommandNode<CommandSourceStack> node : child(iris, "structure").getChildren()) {
|
||||
assertTrue("structure " + node.getName() + " must be a literal", node instanceof LiteralCommandNode);
|
||||
}
|
||||
for (String branch : new String[]{"module", "m"}) {
|
||||
CommandNode<CommandSourceStack> module = child(iris, branch);
|
||||
assertNotNull(branch + " lists the mounted commands on its own", module.getCommand());
|
||||
CommandNode<CommandSourceStack> rest = child(module, "command");
|
||||
assertTrue(rest instanceof ArgumentCommandNode);
|
||||
assertEquals(StringArgumentType.StringType.GREEDY_PHRASE, ((StringArgumentType) ((ArgumentCommandNode<?, ?>) rest).getType()).getType());
|
||||
assertNotNull(rest.getCommand());
|
||||
}
|
||||
}
|
||||
|
||||
private static CommandNode<CommandSourceStack> irisNode() {
|
||||
SharedConstants.tryDetectVersion();
|
||||
Bootstrap.bootStrap();
|
||||
CommandDispatcher<CommandSourceStack> dispatcher = new CommandDispatcher<>();
|
||||
IrisModdedCommands.register(dispatcher);
|
||||
return child(dispatcher.getRoot(), "iris");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void consoleHelpListsEveryEntryWithInlineUsageAndDescription() {
|
||||
List<String> root = ModdedCommandHelp.consoleLines("");
|
||||
|
||||
-3
@@ -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 {
|
||||
|
||||
@@ -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 <dimension>, 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 <dimension> 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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
* <p>
|
||||
* 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";
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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 <root> <command...>} 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=<name>} 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 + "<name>";
|
||||
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<String> words) {
|
||||
return run(sender, words, false);
|
||||
public void execute(ToolingSender sender, List<String> 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<String> 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<String> tokens, boolean onlyIfOpenToEveryone) {
|
||||
try {
|
||||
CommandLine line = CommandLine.of(tokens);
|
||||
if (line.words().isEmpty()) {
|
||||
ResolvedPack pack = resolvePack(sender, line.packName());
|
||||
List<CommandRegistration> roots = rootsOf(pack.served());
|
||||
if (line.words().isEmpty() && onlyIfOpenToEveryone) {
|
||||
return false;
|
||||
}
|
||||
ResolvedPack pack = resolvePack(sender, line.packName());
|
||||
Optional<LocatedCommand> located = LocatedCommand.locate(rootsOf(pack.served()), line.words());
|
||||
if (located.isEmpty()) {
|
||||
if (line.words().isEmpty()) {
|
||||
describeMountedRoots(sender, pack.served(), roots);
|
||||
return true;
|
||||
}
|
||||
Optional<LocatedCommand> 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<CommandRegistration> roots) {
|
||||
List<String> 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 <command>:");
|
||||
lines.forEach(line -> sender.info(" " + line));
|
||||
}
|
||||
|
||||
private static void collectUsageLines(ToolingSender sender, List<String> path, Command command, List<String> 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<String> 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());
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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 <structure>"), 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"));
|
||||
|
||||
@@ -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<String> 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 <label> <count> [note]"), sender.infos);
|
||||
@@ -187,8 +187,8 @@ public class ToolingCommandsTest {
|
||||
.child(recording("clear")));
|
||||
standIn(packsByName.get("one"));
|
||||
|
||||
assertTrue(run("tools"));
|
||||
assertTrue(run("tools frobnicate"));
|
||||
run("tools");
|
||||
run("tools frobnicate");
|
||||
|
||||
assertEquals(List.of("tools: Pack tools", " tools list [filter] - List things", " tools clear",
|
||||
"tools: Pack tools", " tools list [filter] - List things", " tools clear"), sender.infos);
|
||||
@@ -196,15 +196,61 @@ public class ToolingCommandsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aLineThatNoRootOwnsIsNotHandled() {
|
||||
public void aLineThatNoRootOwnsIsAnErrorThatPointsToTheList() {
|
||||
packWith("one", recording("tools"));
|
||||
standIn(packsByName.get("one"));
|
||||
|
||||
assertFalse(run("elsewhere now"));
|
||||
assertFalse(run(""));
|
||||
run("elsewhere now");
|
||||
|
||||
assertEquals(List.of("No module command named elsewhere"), sender.errors);
|
||||
assertEquals(List.of("List them with /iris module"), sender.infos);
|
||||
assertTrue(seen.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theBranchAnswersToModuleAndItsAliasInAnyCase() {
|
||||
assertTrue(ToolingCommands.isBranchWord("module"));
|
||||
assertTrue(ToolingCommands.isBranchWord("M"));
|
||||
assertFalse(ToolingCommands.isBranchWord("structure"));
|
||||
assertFalse(ToolingCommands.isBranchWord("mod"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noCommandWordListsTheMountedRootsWithTheirCommandsForTheSender() {
|
||||
packWith("one",
|
||||
Command.named("tools").describe("Pack tools")
|
||||
.child(Command.named("list").describe("List things").argument(Argument.word("filter").orElse("all"))
|
||||
.runs(context -> { }))
|
||||
.child(Command.named("clear").runs(context -> { })),
|
||||
Command.named("ping").describe("Answer").openToEveryone().runs(context -> { }),
|
||||
Command.named("shape").runs(context -> { }));
|
||||
standIn(packsByName.get("one"));
|
||||
|
||||
sender.operator = false;
|
||||
run("pack=one");
|
||||
|
||||
assertEquals(List.of("Module commands of pack one, run as /iris module <command>:", " ping - Answer"), sender.infos);
|
||||
assertTrue(sender.errors.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theListNamesEveryCommandOfAnOperatorAndSaysSoWhenAPackHasNone() {
|
||||
packWith("one",
|
||||
Command.named("tools")
|
||||
.child(Command.named("list").describe("List things").argument(Argument.word("filter").orElse("all"))
|
||||
.runs(context -> { }))
|
||||
.child(Command.named("clear").runs(context -> { })),
|
||||
Command.named("ping").runs(context -> { }));
|
||||
packWith("bare");
|
||||
|
||||
run("pack=one");
|
||||
run("pack=bare");
|
||||
|
||||
assertEquals(List.of("Module commands of pack one, run as /iris module <command>:",
|
||||
" ping", " tools list [filter] - List things", " tools clear",
|
||||
"No module of pack bare has commands for you"), sender.infos);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void packOptionIsTakenOutOfTheLineWhereverItStands() {
|
||||
Argument<String> label = Argument.word("label");
|
||||
@@ -269,8 +315,8 @@ public class ToolingCommandsTest {
|
||||
standIn(packsByName.get("alpha"));
|
||||
sender.operator = false;
|
||||
|
||||
assertTrue(run("locked"));
|
||||
assertTrue(run("public"));
|
||||
run("locked");
|
||||
run("public");
|
||||
assertFalse(dispatcher.executeIfOpenToEveryone(sender, words("locked")));
|
||||
assertTrue(dispatcher.executeIfOpenToEveryone(sender, words("public")));
|
||||
|
||||
@@ -287,6 +333,7 @@ public class ToolingCommandsTest {
|
||||
assertFalse(dispatcher.executeIfOpenToEveryone(sender, words("public 9")));
|
||||
assertFalse(dispatcher.executeIfOpenToEveryone(sender, words("missing")));
|
||||
assertFalse(dispatcher.executeIfOpenToEveryone(sender, words("public pack=nowhere")));
|
||||
assertFalse(dispatcher.executeIfOpenToEveryone(sender, words("")));
|
||||
|
||||
assertTrue(sender.errors.isEmpty());
|
||||
assertTrue(sender.infos.isEmpty());
|
||||
@@ -343,7 +390,7 @@ public class ToolingCommandsTest {
|
||||
FakePack broken = new FakePack("broken", null, null);
|
||||
packsByName.put("broken", broken);
|
||||
|
||||
assertTrue(run("anything pack=broken"));
|
||||
run("anything pack=broken");
|
||||
|
||||
assertEquals(List.of("The modules of pack broken did not load: Command root tools is registered by module a already"),
|
||||
sender.errors);
|
||||
|
||||
Reference in new issue
Block a user